Friday, 22 February 2013

.NET Framework

The .NET Framework is a Microsoft platform for building, deploying, developing application with rich UI and running in a Microsoft environment. The Microsoft .NET Framework is a managed code programming model for building applications on Windows clients, servers, and mobile or embedded devices. You can use the .NET Framework to develop the following types of applications and services:
  • Console applications.
  • Windows GUI applications (Windows Forms).
  • ASP.NET applications (Web Application).
  • XML Web services.
  • WCF (Windows Communication Foundation).
  • WPF (Windows Presentation Foundation).
  • WF (Windows Workflow Foundation).
  • Silverlight.
  • Database Application.
  • Mobile Application.
  • Windows Services.
  

.NET Framework Application Execution

Execution Steps:
1. Programmer can write application code into any programming language like c#, VB.NET or J# (around 40 languages are provided by .net framework).
 

2. Each language has its own compiler Ex. C# has its own c# compiler, so code written in c# will be compiled by c# compiler similarly VB.NET code will be compiled by VB.NET complier. Single application can be coded into multiple languages and will be compiled by respective compiler. The compiled code will be provided to Intermediate language which is called as MSIL (Microsoft Intermediate Language).
 

3. MSIL is responsible for converting different compiled code into “Byte Code”
 

4. The “Byte Code” converted by MSIL will be given to CLR to convert the “Byte Code”  into “Native Code” -- The native code is machine readable code which will be compiled by “Just in time compiler” into executable code.
 

5. JIT -- Is responsible for compiling the code into CPU executable code. There are mainly three types of JIT which are listed below
    a. Econo-JIT
-- It compiles only those methods which are called at run time. These compiled methods are removed when they are not required. It mainly takes less compile time for startup.
    b. Pre-JIT - Compiles the complete source code into the native code in a single completion cycle. It is done at the time of deployment
    c. Normal-JIT -- It compiles only those methods which are called at run time, these methods are only compiled once when they are called and are stored into cache.


Base Class Library

Base Class is a part of .NET framework library which provides facility to implement common functionalities into the application like drawing tool, reading and writing file and so many. For example you need to add “System.Data” library to perform ADO.NET operations. BCL is a collection for reusable types that tightly integrate with the common language runtime.

BCL provides built in CLI data types, collection, formatting, security attributes, I/O stream and string manipulation.

Common Language Runtime

The common language runtime (CLR) is responsible for converting human language code written in different programming languages like c#, VB.NET and J# (many more supported by .net framework) into machine executable code with the help of Just in time complier (JIT) which is part of CLR. CLR provides various services, like memory management, type safety, thread management & exception handling. It works as a layer between OS (Microsoft) and application written into .NET.

Memory Management: To execute any .NET program memory management plays a very important role.  Programmer did not need to worry about memory allocation / freeing up for their application objects. CLR – provided facility to automatically allocate application object into memory for the operation to be performed same way when objects are no longer in use CLR using Garbage Collector releases such unused memory which can be reallocated for other program to allocate and execute. Garbage Collector keeps on running recursively to check whether the assigned object on heap are still encapsulated (enclosed) by other object using CLI (Common Language Infrastructure) which is a part of .NET framework.

Exception Handling: CLR will handle any “Run-Time” exception that occurs during the execution of the application. CLR stores the current state of the execution in predefined place and switch the execution to a specific place which is known as exception handler. Handler is responsible to resume the execution at the original location if any exception occurs and jump to appropriate subroutine.


Microsoft .NET Framework Details
Features
.NET Framework Versions

1.0/1.1
2.0
3.0
3.5
3.5 SP 1
4.0
4.5
Released Year
2002-03
2005
2006
2008
2009
2010
2011
C#.Net
Yes
Yes
Yes
Yes
Yes
Yes
Yes
VB.Net
Yes
Yes
Yes
Yes
Yes
Yes
Yes
ASP.NET
Yes
Yes
Yes
Yes
Yes
Yes
Yes
ADO.NET
1.0
2.0
2.0
3.5
3.5
4.0
4.0
Web Service
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Visual Studio
2002/2003
2005
2005
2008
2008
2010
2012
CLR
1.0/1.1
2.0
2.0
2.0
2.0
4.0
4.0
ASP.NET Ajax
No
Yes
Yes
Yes
Yes
Yes
Yes
WPF / WCF /WF
No
No
Yes
Yes
Yes
Yes
Yes
LINQ
No
No
No
Yes
Yes
Yes
Yes
Silverlight
No
No
No
No
Yes
Yes
3.0
ASP.NET MVC
No
No
No
No
Yes
Yes
4.0
F# .NET
No
No
No
No
No
Yes
Yes
Entity Framework
No
No
No
No
Yes
Yes
Yes

Acronyms

WPF - Windows Communication Foundation
WCF - Windows Presentation Foundation
WF - Windows Workflow Foundation
CLR - Common Language Runtime
BCL - Base Class Library
CLI - Common Language Infrastructure
LINQ - Language-Integrated Query
XML - Extensible Markup Language
MVC - Model View Controller
GC - Garbage Collector