简体   繁体   English

程序集加载引用了一些dll

[英]assembly load referenced a few dlls

In my ASP.NET MVC project, I want to make my service classes as a class library. 在我的ASP.NET MVC项目中,我想将服务类制作为类库。
I want to add a few dlls to my main project. 我想在我的主项目中添加一些dll。
The dlls that will be added have assembly references on their own. 将要添加的dll本身具有程序集引用。 Some of them might are the same, such as System etc. 其中一些可能是相同的,例如System等。
Does this architecture effect the main project's performance? 这种架构会影响主项目的性能吗?

Is only one System -dll loaded or is it loaded separately for every class library? 每个类库仅加载一个System -dll还是单独加载?

For a given .NET process, there's (by default) as single AppDomain , which is the environment into which DLLs are loaded and resolved. 对于给定的.NET进程,(默认情况下)有单个AppDomain ,这是DLL加载和解析到的环境。 This means that if you reference DLL X (Say, System.dll), and also reference DLL Y which also references System.dll, it will only be loaded once into the appdomain, and further references will reuse the same instance in memory. 这意味着,如果您引用DLL X(Say,System.dll),并且还引用DLL Y(也引用System.dll),则它将仅加载一次到appdomain中,并且其他引用将在内存中重用同一实例。

This is true for custom assemblies as well. 对于自定义程序集也是如此。 If both X and Y reference Z.dll, it's still only loaded once. 如果X和Y都引用Z.dll,则它仍然仅加载一次。

You can rest easily knowing that you're not causing any bloat here. 您可以轻松地知道自己不会在这里引起任何膨胀。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM