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

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

+3
source share
5 answers

If your project is small enough so that one library is enough for each level, I would go with this approach. This helps maintain a clear separation of concerns.

Separate DLLs will not adversely affect performance in my experience. There are situations where they can help in performance (for example, when loading rarely used components). All DLL files are loaded into the same address space, since one or several DLLs practically do not differ in terms of runtime.

Each layer must be created as if it were used by several interfaces. It will also help maintain separation and help more correct and convenient code.

+2
source

. , . ...

0

, .

, , , ,

0

I prefer one class library for each layer. It provides good organization and hierarchy between libraries. For example, the user interface layer never knows about the Data Access Layer, and it cannot know, because it does not have a link to the data access layer.

However, sometimes layers are placed in the same class library to reduce compilation time. If you do not have such overhead, always choose a separate one.

0
source

Source: https://habr.com/ru/post/1796138/


All Articles