C# Unit 1st: Akhil
C# Unit 1st: Akhil
C# Unit 1st: Akhil
The .NET framework exposes numerous classes to the developer. These classes allow the development of rich client applications and Web based applications alike. In the above slide these classes have been divided into 4 areas.
Web forms Manageable code (non spaghetti) Logical evolution of ASP (compiled) Again, well drill into a hint at the power of Web Forms with a demonstration
Technically a Web Service is A programmable application component accessible via standard Web protocols. In other words, its a component that can be called remotely, over the internet, from a client application.
Take our previous example of a Web application that required stock information. This Web application possibly would not have that information readily at hand. However, what if another Web application (possibly on another machine, on the other side of the planet) did? Further more what if this remote machine exposed a component with a method such as GetStockPrice (string strCompanyName). Surely this would make life much easier, making separate Web sites act like one big application. Web service consumers can send and receive messages using XML, and therefore the audience of clients is unlimited. ADO.NET, evolution of ADO ADO.NET(Data and XML) New objects (e.g., DataSets) Separates connected / disconnected issues Language neutral data access Uses same types as CLR Great support for XML New objects (e.g., DataSets, Datareader) Visual Studio.NET Most productive development environment gets better and fully supports the .NET Framework Windows Forms Framework for Building Rich Clients RAD (Rapid Application Development) Rich set of controls Data aware ActiveX Support Licensing Accessibility Printing support Unicode support UI inheritance ASP.NET Web Forms Allows clean cut code Code-behind Web Forms Easier for tools to generate Code within is compiled then executed Improved handling of state information Support for ASP.NET server controls
What is "Common Type System" (CTS)? CTS defines all of the basic types that can be used in the .NET Framework and the operations performed on those type. All this time we have been talking about language interoperability, and .NET Class Framework. None of this is possible without all the language sharing the same data types. What this means is that an int should mean the same in VB, VC++, C# and all other .NET compliant languages. This is achieved through introduction of Common Type System (CTS)
CTS (Common Type System) : Common Type System is the part of .NET Framework built in with CLR which is responsible for defining , managing different language's operation supported by .NET Framework. CTS (Common Type System) : Common Type System is the part of .NET Framework built in with CLR which is responsible for defining , managing different language's operation supported by .NET Framework. Let's see some other definitions: The common type system is a rich type system, built into the common language runtime, that supports the types and operations found in most programming languages. The common type system supports the complete implementation of a wide range of programming languages. (Source MSDN) The Common Type System (CTS) is a standard that specifies how Type definitions and specific values of Types are represented in computer memory. It is intended to allow programs written in different programming languages to easily share information. As used in programming languages, a Type can be described as a definition of a set of values (for example, "all integers between 0 and 10"), and the allowable operations on those values (for example, addition and subtraction). (Source Wikipedia) Use / Importance of CTS: CTS are responsible for cross language Integration (Means you can have a dll which is written in C# and to be used in VB.Net application) and Type Safety. Enforce a set of rules that a programming language must follow.
A Web Service or Web Forms file must be compiled to run within the CLR. Compilation can be implicit or explicit. Although you could explicitly call the appropriate compiler to compile your Web Service or Web Forms files, it is easier to allow the file to be complied implicitly. Implicit compilation occurs when you request the .asmx via HTTP-SOAP, HTTP-GET, or HTTP-POST. The parser (xsp.exe) determines whether a current version of the assembly resides in memory or in the disk. If it cannot use an existing version, the parser makes the appropriate call to the respective compiler (as you designated in the Class property of the .asmx page). When the Web Service (or Web Forms page) is implicitly compiled, it is actually compiled twice. On the first pass, it is compiled into IL. On the second pass, the Web Service (now an assembly in IL) is compiled into machine language. This process is called Just-In-Time JIT compilation because it does not occurs until the assembly is on the target machine. The reason you do not compile it ahead of time is so that the specific JITter for your OS and processor type can be used. As a result, the assembly is compiled into the fastest possible machine language code, optimized and enhanced for your specific configuration. It also enables you to compile once and then run on any number of operating systems.
How JIT Works? Before MSIL(MS Intermediate Language) can be executed, it must converted by .net Framework Just in time (JIT) compiler to native code, which is CPU specific code that run on some computer architecture as the JIT compiler. Rather than using time and memory to convert all the MSIL in portable executable (PE) file to native code, it converts the MSIL as it is needed during execution and stored in resulting native code so it is accessible for subsequent calls. The runtime supplies another mode of compilation called install-time code generation. The install-time code generation mode converts MSIL to native code just as the regular JIT compiler does, but it converts larger units of code at a time, storing the resulting native code for use when the assembly is subsequently loaded and executed. As part of compiling MSIL to native code, code must pass a verification process unless an administrator has established a
JIT Types: In Microsoft .NET there are three types of JIT (Just-In-Time) compilers which are Explained as Under:
Pre-JIT Compiler (Compiles entire code into native code completely) Econo JIT Compiler (Compiles code part by part freeing when required) Normal JIT Compiler (Compiles only that part of code when called and places in cache
Description:
Pre-JIT COMPILER Pre-JIT compiles complete source code into native code in a single compilation cycle. This is done at the time of deployment of the application.
Econo-JIT COMPILER: Econo-JIT compiles only those methods that are called at runtime. However, these compiled methods are removed when they are not required.
Normal-JIT COMPILER: Normal-JIT compiles only those methods that are called at runtime. These methods are compiled the first time they are called, and then they are stored in cache. When the same methods are called again, the compiled code from cache is used for execution. These methods are compiled the first time they are called, and then they are stored in cache. When the same methods are called again, the compiled code from cache is used for execution.