Click here to Skip to main content
15,896,726 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI,

I have a doubt .Net Concepts

How assemblies are usefull?


Thanks
vamsi
Posted

They allow you to break your code into smaller, independent sections that can be worked on individually without changing other code.
As an example, take the .NET framework: it is a set of assemblies which you do not need to change, or see the source code for in order to write your application. The same assemblies are reused in all your applications. You can create the same thing: a Data Access Layer for example could be an assembly, which is used in three or four different programs to interface to the same database. Because it works, there is no need for the code to be re-written each time you want to use that database. This improves reliability.

Think about cars: most of a car is assemblies: Running gear, engine, electrical system, seating, trim, bodywork. An individual car manufacturer will buy in the assemblies (at some level) and use them to build bigger assemblies, until the car is complete. No car manufacturer makes it's own batteries and headlamps - they buy them in to their requirements form specialist companies who produce them as ready-made assemblies.
 
Share this answer
 
Comments
VJ Reddy 13-Jun-12 1:32am    
Nice explanation. 5!
Manas Bhardwaj 13-Jun-12 4:08am    
very well explained +5!
In short:
Assemblies are designed to simplify application deployment and to solve versioning problems that can occur with component-based applications.

The word Assembly means it is A group of some parts that fit together to form a self-contained unit.

* So in asp.net, An assembly is a collection of single or multiple files.
* Assembly physically exist as DLLs or EXEs
* The constituent files can be any file types like image files, text files etc. along with DLLs or EXEs
* The assembly also contains metadata that is known as assembly manifest.
* The assembly manifest contains data about the versioning requirements of the assembly, like author name of the assembly, the security requirements to run and the various files that form part of the assembly.
* When you compile your source code by default the exe/dll generated is actually an assembly.
* More accurately, an assembly is the primary unit of deployment, security, and version control in the .NET Framework.

Advantages of Assemblies:

1. ASP.Net assemblies has a lot of good advantages when compare to conventional DLLs that the developers use to develop earlier. In the case of DLLs if a DLL has to be shared with some other application, it has to be registered in that particular machine. But, In the case of Asp.net assemblies there is no such type of registration required. Here we just need to do is to copy the assembly and put in the bin directory of the application that is going to use it.

2. If we need to share a particular assembly with any other applications., we can do so by placing the assembly in the Global Assembly Cache (GAC). But before we going to do it we need to give a strong name to that assembly. Strong name is similar to GUID(It is supposed to be unique in space and time) in COM, components. Strong Name is only needed when we need to deploy assembly in Global Assembly Cache (GAC).Strong Names helps GAC to differentiate between two versions. Strong names use public key cryptography (PKC) to ensure that no one can spoof it. PKC use public key and private key concept.

3. Another advantage of using ASP.Net assemblies is the ability to read the contents of an assembly. Each assembly has a manifest that has details about the assembly itself.

4. The System.Reflection namespace has classes like Assembly which can be used to get the details of the assembly and with that it is also possible to load an assembly dynamically at runtime.

Also have look on: Assembly Benefits[^]

You can get all details of Assemblies on this link:
http://msdn.microsoft.com/en-us/library/hk5f40ct(v=vs.71)[^]
 
Share this answer
 
Comments
VJ Reddy 13-Jun-12 1:32am    
Nice explanation. 5!
Prasad_Kulkarni 13-Jun-12 4:50am    
Thank you VJ!
Manas Bhardwaj 13-Jun-12 4:08am    
very well explained +5!
Prasad_Kulkarni 13-Jun-12 4:50am    
Thank you Manas!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900