Custom Search

Friday, March 15, 2013

Assembly,Metadata,Attributes


Assembly,Metadata,Attributes

What is an assembly?

Definition:
  • An assembly is the primary building block of a .NET Framework application.
  • It is a collection of functionality that is built, versioned, and deployed as a single implementation unit.
  •  All managed types and resources are marked either as accessible only within their implementation unit, or as accessible by code outside that unit. .NET Assembly contains all the metadata about the modules, types, and other elements it contains in the form of a manifest.
  • The CLR loves assemblies because differing programming languages are just perfect for creating certain kinds of applications.
  • For example, COBOL stands for Common Business-Oriented Language because it’s tailor-made for creating business apps. However, it’s not much good for creating drafting programs.
  • Regardless of what language you used to create your modules, they can all work together within one Portable Executable Assembly.
  • There’s a hierarchy to the structure of .NET code. That hierarchy is Assembly - > Module -> Type -> Method." Assemblies can be static or dynamic.
  •  Static assemblies can include .NET Framework types (interfaces and classes), as well as resources for the assembly (bitmaps, JPEG files, resource files, and so on).
  • Static assemblies are stored on disk in portable executable (PE) files. You can also use the .NET Framework to create dynamic assemblies, which are run directly from memory and are not saved to disk before execution. You can save dynamic assemblies to disk after they have executed.



What is a Metadata?

Definition:

  • Metadata is information about a PE. In COM, metadata is communicated through non-standardized type libraries. 

  • In .NET, this data is contained in the header portion of a COFF-compliant PE and follows certain guidelines; 
  • it contains information such as the assembly’s name, version, language, what external types are referenced, what internal types are exposed, methods, properties, classes, and much more. 

  • The CLR uses metadata for a number of specific purposes. Security is managed through a public key in the PE’s header. 

  • Information about classes, modules, and so forth allows the CLR to know in advance what structures are necessary. The class loader component of the CLR uses metadata to locate specific classes within assemblies, either locally or across networks. 

  • Just-in-time (JIT) compilers use the metadata to turn IL into executable code. 



What are Attributes?

Definition:

Attributes are declarative tags in code that insert additional metadata into an assembly. There exist two types of attributes in the .NET Framework: Predefined attributes such as AssemblyVersion, which already exist and are accessed through the Runtime Classes; and custom attributes, which you write yourself by extending the System.Attribute class.

No comments:

Post a Comment