What Is the .NET Framework?

Introduced in June 2000, the Microsoft .NET Framework is the next-generation, revolutionary development platform for building Windows, web, and mobile applications.

Prior to the introduction of the .NET platform, developers used programming languages such as C++ and Visual Basic to build Windows applications using the non-object-oriented Win32 API and object-oriented APIs such as the Microsoft Foundation Class (MFC) library. Web applications were built using Active Server Pages (ASP) in the VBScript and JScript programming languages. There was not good support for building XML web services or mobile applications. The Component Object Model (COM) was used as a cross-language component-based development platform. This generation of developer technologies combined with the limited cross-language development and debugging facility restricted developers' productivity. Microsoft .NET changes this by introducing the next generation of tools, infrastructure, and technologies to significantly improve developers' productivity.

Here are some of the benefits offered by the .NET Framework:

  • Cross-language development and language interoperability Regardless of what .NET language you use to write the code, the compiler generates Microsoft Intermediate Language (MSIL) at the compile time. The MSIL instructions are then compiled to native platform language code at execution time. While building .NET solutions, you can write code using your choice of language, such as VB .NET, inherit from or make use of classes written by some other developer, possibly in a different .NET language, such as C#, and still be able to debug across languages by using Visual Studio .NET. The Common Type System (CTS) and Common Language Specification (CLS) defined by the .NET Framework facilitate cross-language development and debugging.

  • .NET Framework base class library The .NET Framework comes with a unified object-oriented class library that provides the functionality earlier provided by the Win32 API and more. This extensive library provides consistent and very easy-to-use classes for data access, XML processing, graphical device interface (GDI), I/O, security and cryptography, network programming, serialization, distributed applications, web applications and web services, collections, and more.

  • Garbage collection As discussed in the next section, the CLR takes care of de-allocating objects, freeing memory, and hence avoiding the memory leaks common in C/C++ programming. CLR tracks the code's use of objects and ensures that objects are not freed while still in use and that objects are freed when no longer in use. Memory management is one of the primary benefits of the CLR's managed execution mode, which greatly simplifies the writing of .NET code because the developer does not have to worry about releasing the memory. The garbage collection algorithm intelligently frees objects and manages the memory.

  • Code access security and type verification Based on the security policies or permissions defined at the enterprise level, machine level, and user level, the same .NET code can or cannot perform an action, depending on the origin or identity of the code. For instance, a .NET assembly executed from a local drive can perform a particular action, but the same assembly if downloaded and executed from a network or an Internet location cannot perform the same action. During the MSIL-to-native code compilation at runtime, the .NET Framework can verify the code to ensure that it is accessing the types in a safe manner (that is, the objects are used the way they were intended to be used, preventing an object's state from being corrupted). Type safety ensures that memory structures are accessed only in well-defined ways. Code access security and type verification are two important features that aid in building secure and reliable applications.

  • Self-describing assemblies Assemblies in the .NET Framework are .dll and .exe files that are the fundamental unit for packaging, deployment, and versioning. Assemblies are also important in .NET with respect to security because many of the security restrictions are enforced at the assembly boundary. In addition to MSIL code, every .NET assembly contains metadata, which is information that describes the assembly. This includes version, culture, and public key information; referenced assemblies; information about classes and class members and their visibility; and so on. By looking at assembly metadata, the CLR knows exactly what other assemblies are required by the assembly. An assembly may consist of multiple files, including resource files for internationalization.

  • Interoperability with Win32 and COM code Microsoft realized that it is critical to allow the calling of classic Win32 or COM objects from within .NET. Although not recommended, it is possible to call a Win32 API from within .NET managed code by using a technique known as PInvoke and to call a COM object from within .NET managed code by using a technique known as COM Interop.

  • Object-oriented programming A .NET assembly consists of one or more classes or types. Every type in the .NET Framework is directly or indirectly derived from the Object class in the System namespace. A .NET Framework application can implement object-oriented programming features such as encapsulation, inheritance, and polymorphism.

The .NET Framework bundles everything you need to build and execute .NET applications. It includes the Framework Class Library, CLR, and language compilers, such as the C# compiler (csc.exe) and the VB .NET compiler (vbc.exe), which you can use to turn your source code into an assembly that contains MSIL instructions, metadata, and resources. Visual Studio .NET is an integrated development environment (IDE) for building and debugging .NET applications. The .NET Framework is free and is already installed with operating systems such as Windows XP SP2 and Windows Server 2003. However, Visual Studio .NET is a commercial development tool that must be purchased. The next version of this tool, Visual Studio .NET 2005, codenamed "Whidbey," includes the templates that allow you to create SQL Server 2005 stored procedures, functions, aggregates, triggers, and types, using managed languages such as C# and VB .NET.

Let's now look at the CLR in a little more detail.

What Is the CLR?

At the heart of the .NET Framework is the execution environment called the CLR. The CLR provides several important services to the hosting application. It is responsible for memory management, object lifetime management, thread management, type safety, security, and I/O management. Any code running under the CLR execution environment is termed managed code. If you call a Win32 function or a COM object from within .NET code, it is referred to as unmanaged code because the CLR does not control Win32 API or COM object code.

The CLR architecture allows it to be hosted by another program. A process can load (that is, host) the .NET runtime and use it to run code in a managed environment. Internet Explorer, ASP.NET, and SQL Server 2005 are examples of processes that host the CLR. The CLR hosting facility offers several options that the host can provide to control the behavior of CLR functions, such as garbage collection and assembly loading. The CLR 2.0 hosting facility has undergone a major overhaul to support the security, stability, reliability, and performance requirements of the SQL Server 2005 host. This is discussed in the following section.

Microsoft SQL Server 2005(c) Changing the Paradigm
Microsoft SQL Server 2005: Changing the Paradigm (SQL Server 2005 Public Beta Edition)
ISBN: 0672327783
EAN: 2147483647
Year: 2005
Pages: 150

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net