Monday, May 21, 2007

.NET Assembly Features

· Self Description
· .NET Assemblies and the .NET Framework class Library
· Cross-Language Programming
· Interoperation with COM and other Legacy Code

1. Self-Description
What makes the .NET Component installation much easier?
.NET Assemblies are fully self-describing. All this information (description) is contained within the assembly itself – there is no need to look up information in the Registry or elsewhere about the objects contained within the assembly. This makes installation of a .NET Component much easier and more straightforward than with the existing Windows technologies. It is as easy as copying the assemblies onto the disk of the target system.
The self-description of .NET assemblies includes:
· Names of Objects and Methods
· Data types of parameters
· Information about what version the objects are
· Controls security for the contained objects

2. .NET Framework Class Library (FCL):
The .NET FCL classes are used whenever you call a method from the System namespace with the using System directive.
All the system namespaces belong to the .NET Framework Class Library (FCL). Each class within this library is part of self-describing assembly. For ex, the drawing classes are contained in the System.Drawing.dll assembly.
If you add a reference to this assembly in VS 2005, the compiler will include a reference to that assembly when it builds the assembly for your program. At runtime, the CLR reads the metadata in your program’s assembly to see what other assemblies it needs, then locates and loads those assemblies for your program to use.
Note:
· Assembly contain information from more than one name-space
· A single namespace may spread across several assemblies
For ex, the System.Data.dll assembly actually contains some functionality from both the System.Data and the System.Xml namespaces, while the other functionality in the System.Xml namespace is implemented in the System.Xml.dll assembly. Within your program, you are referring to a namespace when specifying the using directive; the references in you VS 2005 project specify the actual assemblies used.

3. Cross-Language Programming
Assemblies enable cross-language programming, since components can be called from any .NET language. Regardless of the language they were originally written in.

.NET provides a number of features that enable cross-language programming:
· The Common Language Runtime (CLR), which manages the execution of all .NET assemblies
· MSIL, generated by all the .NET language compilers. This is a common standard for the binary code generated by the compilers and is what is executed by the CLR. The CLR also defines the format for storing an assembly’s metadata, and this means that all assemblies, whatever language they were written in, share a common format for storing their metadata.
· The programs written in any .NET languages is CLS-Compliant can share components with full inheritance across language boundaries. The CLS defines the features that languages must support in order to support interoperability with other .NET languages.

4. Interoperation with COM and other Legacy Code
The .NET Framework also allows components or libraries written using COM and other legacy technologies to be used with C# and other .NET Technologies. A wrapper assembly is created for the legacy code that allows it to describe itself to the .NET runtime and convert the COM data types to .NET data types, and allow calls back and forth from the .NET languages to the legacy code and vice versa.
VS 2005 automatically creates a wrapper assembly when you add a reference to a COM component.
Calls made by the .NET client assembly go thru the Wrapper to get the COM Component.
.NET Client Assembly ----------------Wrapper Assembly-----------------COM Component.

No comments: