.NET中的程序集优势 [英] Assemblies advantages in .net

查看:53
本文介绍了.NET中的程序集优势的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,

我怀疑.Net概念

程序集如何有用?


谢谢
vamsi



I have a doubt .Net Concepts

How assemblies are usefull?


Thanks
vamsi

推荐答案

它们使您可以将代码分成较小的独立部分,这些部分可以单独进行处理而无需更改其他代码.
例如,以.NET框架为例:它是一组程序集,您无需更改它们,也无需查看源代码即可编写应用程序.相同的程序集将在所有应用程序中重复使用.您可以创建同一事物:例如,数据访问层可以是程序集,该程序集可在三个或四个不同的程序中使用以与同一个数据库接口.因为它可以工作,所以每次您要使用该数据库时都不需要重新编写代码.这样可以提高可靠性.

考虑一下汽车:大多数汽车是装配体:行走机构,发动机,电气系统,座椅,装饰,车身.一家汽车制造商将购买(在某种程度上)总成,并使用它们来制造更大的总成,直到汽车制造完毕.没有一家汽车制造商会自行生产电池和大灯,而是按照专业公司的要求购买它们,而这些公司将其作为现成的组件进行生产.
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.


总之: 程序集旨在简化应用程序部署并解决基于组件的应用程序可能发生的版本控制问题.

装配一词表示一些零件的一部分,这些零件装配在一起以形成一个独立的单元.

*因此,在asp.net中,程序集是单个或多个文件的集合.
*程序集实际上以DLL或EXE的形式存在
*组成文件可以是任何文件类型,例如图像文件,文本文件等,以及DLL或EXEs
*程序集还包含称为程序集清单的元数据.
*程序集清单包含有关程序集版本要求的数据,例如程序集的作者名称,要运行的安全性要求以及构成程序集一部分的各种文件.
*默认情况下,在编译源代码时,生成的exe/dll实际上是程序集.
*更准确地说,程序集是.NET Framework中部署,安全性和版本控制的主要单元.

装配的优点:

1.与开发人员用于较早开发的常规DLL相比,ASP.Net程序集具有许多良好的优势.对于DLL,如果必须与某个其他应用程序共享DLL,则必须在该特定计算机上注册它.但是,对于Asp.net程序集,不需要不需要这种类型的注册.在这里,我们只需要复制程序集并将其放在将要使用它的应用程序的bin目录中.

2.如果需要与任何其他应用程序共享特定的程序集,则可以通过将程序集放置在Global Assembly Cache (GAC)中来实现.但是在执行此操作之前,我们需要为该程序集起一个强大的名称.强名类似于COM组件中的GUID(在时间和空间上应该是唯一的).仅当我们需要在全局程序集缓存(GAC)中部署程序集时,才需要使用强名称.强名称可以帮助GAC区分两个版本.强名使用public key cryptography (PKC)来确保没有人可以欺骗它. PKC使用公钥和私钥概念.

3.使用ASP.Net程序集的另一个优点是能够读取程序集的内容. 每个程序集都有一个清单,其中包含有关程序集本身的详细信息.

4. System.Reflection名称空间具有类似于Assembly之类的类,可用于获取程序集的详细信息,并且还可以在运行时动态加载程序集.
也请查看:组装好处 [ http://msdn.microsoft.com/en-us/library/hk5f40ct(v = vs.71) [ ^ ]
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)[^]


这篇关于.NET中的程序集优势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆