To work on ASP. NET and to understand
the ASP. Net World, first we have to understand .NET Framework. .
It is a common question which is asked in interviews that "What
is .NET Framework? and what is the need of .NET Framework?"
As I know about my friends and caliuge
who is working as a web developer also faces a problems on .NET
Framework's questions. So, today I decided to write about .NET
framework.
.NET Framework
1. .NET framework is a complete
development and execution environment. That allows the developer to
develop , run and deploy the following application.
a. Console application. b. Windows
application c. Web application
d. Service oriented application
(WCF) e. Web service f. Windows service
g. WPF, WWF etc.
2. .Net framework support the object
oriented programming model for multiple language such as, C#, VB,
vC++, J# etc.
3. It support the language
interoperability .Interoperability implies that each language can use
the code written in some other language.
4. It provides a common set of tools
enables easy integration of module developed with one another.
5. It also enables the developers to
create sharable component to be used in distributed computing
architecture.
Need of .NET Framework
.NET Framework was designed to fulfill
the following goals.
a. Interoperability b. Cross
platform Support c. Language Independence
d. Base class library. e. Easy
development f. Security
Interoperability: .NET Framework
supports interoperability between new application and existing
application. It implies that the code written in one language can be
used in some other language.
Cross Platform support: Each
.NET compatible language, such as C#, VB, VC++ provides its own
compiler to compile code to MSIL . After that , the common runtime
engine compile MSIL code to native code with the help of Just In Time
(JIT) compiler and then run the application.
Language Independence: .NET
framework provides the multiple language support by using the feature
known as common type system. That is built into common language
runtime.
Base Class Library: The base
class library provides the fundamental building block for any
application you develop. These application could be windows , web,
console, or service oriented. The BCL mostly serves as the main point
of interaction with the CLR.
Easy Deployment: .NET Framework
makes the task of employment easier. In most cases , to install an
application along with component on the target computer.
Security: .NET Framework
provides security model that allows you to authorize and authenticate
the user.
Component of .NET
Framework
Following are the main component of the
.NET Framework.
1. .Net Framework library 2.
CLR 3. DLR (Dynamic Language Runtime
4. Application Domain 5. Runtime
host 6. CTS ( Common Type System)
7. Metadata 8. Cross Language
Interoperability
9. Security 10. Side by side
execution 11. Profiling etc.
Above all components discussed
separately in next topic.
MSIL (Microsoft
Intermediate Language) OR Intermediate Language( IL)
IL stands for Intermediate Language. It
is also known as MSIL(Microsoft Intermediate Language) or CIL
(Common Intermediate Language ). All the .NET language such as C#,
J#,VB uses there own compiler. the compiler compile the code into IL
and after than common runtime engine convert the IL code into native
code with the help of JIT compiler. OR …
MSIL : .Net is shipped with
compiler of all programming language to develop program. There are
separate compiler for the VB, C#, VC++ etc. All compilers produce an
intermediate code after compiling source code. The intermediate code
is common for all language and it is understandable into .NET
environment. This intermediate code is known as IL or MSIL.
Assembly Manifest
Assembly manifest stores the assembly
metadata. It contains all the metadata needed to do the following
things :-
1. Version of assembly
2. Security Identity
3. Scope of assembly
4. Resolve reference to resource of
class
Assembly manifest contains PE file
either .exe or .dll
Common Type System
CTS is a component of CLR (Common
Language Runtime) through which .NET framework provide support for
multiple language. Because it contains a type system, that is common
across all the language. Two common type system language do not
require type conversion when calling the code written in another
language. CTS provide a base set of data type for all language
supported by .NET framework. This means that the size of integer and
long variable is same across all language.
Managed and Unmanaged
code
Managed Code : Managed code is
the code that executed directly by CLR instead of operating system.
The language compiler compile the managed code to IL or MSIL. This
code does not depend on the machine configuration and can be executed
on different machine. Manage code process are as follows :-
Choose Language Compiler -->
Compile to MSIL --> MSIL to Native Code -->Execute the code
Unmanaged Code : Unmanaged code
is the code that is executed directly by the operating system outside
the CLR environment. It is directly compiled to native machine code
which depends on the machine configuration. In unmanaged code, The
allocation of memory , Type safety and security is required to be
taken care of by the developer. If unmanaged code is not properly
handled. It may result in memory leak.
Assembly in .NET
framework
Every software has an executable file
(.exe) apart from the .exe file, there are some dynamic link library
(.dll) and Library file (.lib) that contains the compiled code of
some commonly used function. These file are shipped along with the
software. Any software package includes an executed file along with
some DLL and LIB file that are necessary to run the application. In
term of .NET runtime, the process of packing is called assembly. An
assembly contains MSIL, Metadata file are required to execute a .NET
program successfully. There are two types of assembly. They are :
1. Private Assembly 2. Public
assembly
Global Assembly Catch
(GAC )
While using shared assembly, To avoid
assembly being overwritten by the different or same assembly .
Shared assembly are placed in a special directory in the file system
are known as global assembly catch.
Or
GAC is a central repository (cache) in
a system in which assemblies are registered to share among various
applications that execute on local or remote machines. .NET Framework
provides the GAC tool (gacutil.exe utility), which is used to view
and change the content of GAC of a system. Adding new assemblies to
GAC and removing assemblies from GAC are some of the tasks that can
be performed by using the gacutil.exe utility. GAC can contain
multiple versions of the same .NET assembly. CLR checks GAC for a
requested assembly before using information of configuration files.
Component and services
of CLR
There are several component of CLR,
Which are as follows :
1. CTS 2. MSIL 3. Execution Support
Function 4. Security
5. Garbage collection 6. Class
loader 7. Memory layout
Services of CLR :
1. Loading and execution of program 2.
Memory Isolation for application
3. Verification of type safety. 4.
Compilation of MSIL to native code
5. Providing Metadata 6.
Interoperability with other system
7. Managing exception and error 8.
Debugging and profiling.
Garbage collection
Garbage collection prevent memory leaks
during execution of programs. It is a low priority process that
manages the allocation and deallocation of memory in your
application. It checks for unreferenced variable and objects. If GC
find any object that is no longer uses by application, it frees up
the memory that object.
GC has changed a bit in .Net framework
4.0. It contains following overload method.
1. GC.collect () 2. GC.collect (int,
GC collection method)
Generation of garbage
collection :
1. Generation 0 : when an object is
initialized.
2. Generation 1 : The object under
the GC process.
3. Generation 2 : whenever new
object are created and added to memory. It adds generation 0 and
generation 1.
Namespace in .Net
framework
Namespace has two basic functionality
:-
1. It is a logically group type.
2. In object oriented world many times
it is possible that , programmer will use the same class name by
qualifying namespace with class name, this collision is able to
remove.
Difference between
Assembly and Namespace
1. An assembly is a physical grouping
of logical unit. While namespace is logically group of class.
2. A namespace can span multiple
assembly.
3. It is a collection of name wherein
each name is unique. While assembly is an output unit. It contains a
unit of development and deployment.
Difference between
private and shared assembly
Private assembly is used inside an
application only and does not have to be identified by a strong name.
Shared assembly can be used by multiple applications and has to have
a strong name.
Very nice Thanks for sharing
ReplyDeleteDot Net Online Course Bangalore
Very nice Thanks for sharing
ReplyDeleteDot Net Online Course Bangalore
Good job in presenting the correct content with the clear explanation. The content looks real with valid information. Good Work
ReplyDeleteDot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery