.Net Framework: Is an environment that facilitates Object Oriented Programming Model for multiple languages. It wraps OS and insulates Software Development from many OS specific tasks such as file handling, memory allocation & management.
It has two main components CLR and .Net Class Libraries.
CLR: Common Language Runtime. It is heart of .Net Framework. Core of CLR is it’s execution engine which loads, executes and manages the managed code that has been compiled to Intermediate Language (MSIL).
CTS: Common Type System. It defines the common set of types that can be used in different languages regardless of OS and hardware. Each language is free to provide/define it’s own syntaxes.
CTS defines that how types are declared, used and managed in runtime. Most important addition is runtime support for cross language integration. It does:
- Establishes a Framework
- Provides Object Oriented Programming Model
- Defines set of rules that language must follow to be CLR compliant.
CLS: Common Language Specification. It is Subset of CTS which is all .Net languages are expected to implement. Idea behind the CLS is Cross Language Integration.
Managed Code: The .Net framework provides several core run-time services to the programs that run within it. For example exception handling and security. For these services to work the code must provide a minimum level of information to runtime. Such code is called Managed Code.
Managed Data: This is data for which memory management is done by .Net runtime’s garbage collector this includes tasks for allocation de-allocation. We can call garbage collector to collect un-referenced data by executing System.GC.Collect()
What is an Assembly?: are fundamental building blocks of .Net Framework. They contains the type and resources that are useful to make an application. Assemblies enables code reuse, version control, security and deployment. An assembly consist of: Manifest, Type Metadata, MSIL and resource file.
Assemblies are Private and Shared. Private are used for a single application and installed in application’s install directory or its sub-directory. Shared assembly is one that can be referenced by multiple application and resides in GAC(local cache for assemblies managed by .Net Framework).
gacutil /i myDll.dll can see and %windir%\assembly
Metadata and Menifest: Menifest describes the assembly itself. Assembly name, version, culture, strong name, list of files, type reference and reference assembly. While Metadata describes contents within the assembly like classes, namespaces, interfaces, scope, properties, methods and their parameters etc.
Application Domain: is a virtual process that serves to isolate an application. All object created within the same application scope are created within same application domain.
Garbage Collection: is Automatic Memory Manager for .Net Framework. It manages the memory allocated to .Net Framework.
When a variable is defined it gets a space in memory (stack) and when an object is created memory for the object is allocated in heap. When an object is assigned to a variable it increments the reference counts for the object and when program control comes out of the function the scope of variable gets ended Or NULL is assigned to variable it decrements the reference count of object by 1. When reference count of one object becomes zero GC acts call destructor of object and then releases the memory acquired by the object.
Can .Net Components can be used from a COM? Yes, can be used. But There are few restrictions such as COM needs an object to be created. So static methods, parameterized constructor can not be used from COM. These are used by COM using a COM Callable Wrapper (CCW).
TlbImp.exe and TlbExp.exe
How does .NET Remoting work? It involves sending messages along channels. Two of the standard channels are HTTP and TCP. TCP is for LANs only and HTTP can be used on LANs or WANs (internet). TCP uses binary serialization and HTTP uses SOAP (.Net Runtime Serialization SOAP Formatter).
There are 3 styles of remote access:
SingleCall: Each incoming request is handled by new instance.
Singleton: All requests are served by single server object.
Client-Activated Object: This is old state-full DCOM model. Where client receives reference to the remote object and keep until it finished with it.
Versioning: MajorVersion.MinorVersion.BuildNumber.Revision
DLL-HELL: situations where we have to put same name Dlls in single directory where are Dlls are of different versions.
Comments