开发者

N-Layered ASP.NET Application: One class library for all my layers or one class library for each layer?

开发者 https://www.devze.com 2023-02-14 12:20 出处:网络
N-开发者_JAVA技巧Layered ASP.NET Application: One class library for all my layers or one class library for each layer?If your project is small enough that only one library suffices for each layer, the

N-开发者_JAVA技巧Layered ASP.NET Application: One class library for all my layers or one class library for each layer?


If your project is small enough that only one library suffices for each layer, then I would go with that approach. This helps to maintain a clear separation of concerns.

Separate DLLs will not adversly affect performance in my experience. There are some situations where it can assist performance (such as delay-loading rarely-used components). All the DLLs are loaded into the same address space, so as far as the runtime is concerned, one or many DLLs makes hardly any difference.

Each layer should be authored as though multiple front-ends are going to be using it. This will further help to maintain separation, and encourage code that is more correct and easier to maintain.


Read

http://codebetter.com/jeremymiller/2008/09/30/separate-assemblies-loose-coupling/


I would go for class library for each layer. This way you could reuse you libraries in other projects. Also this will give you more flexibility...


why not use both, one common class library for all global stuff and one class library for each of the projects for project specific things

of course we need to know more about your particular situation to be more accurate, there is no one-case-fits all solution unfortunately


I prefer one class library for each layer. It provides good organization and hierachy between libraries. For example, UI layer never knows about Data Access Layer and it cannot know since it doesn't have reference to Data Access Layer.

However, sometimes layers are placed in the same class library to shorten the compilation time. If you don't have an overhead like this, always choose seperated one.

0

精彩评论

暂无评论...
验证码 换一张
取 消