Separate projects or multiple class files … namespace best practice in C#

后端 未结 5 1057
被撕碎了的回忆
被撕碎了的回忆 2021-01-13 03:32

I\'m creating a library for use with an application that I am building. I am building a name space structure similar to below.

MyNamespace.Validation
MyName         


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-13 04:17

    Deciding exactly how to break up your solution is subjective - and it really depends on the specifics of your code.

    However, one thing is certain: maintaining multiple assemblies has drawbacks! This article is particularly good at describing those drawbacks, observing how they add costs at development time, compile time, deployment time, and runtime.

    I use as few assemblies as possible, aiming for a single assembly while isolating volatile areas of the domain. When multiple assemblies are clearly appropriate or required (and they often are, particularly to enforce decoupling), I do my best to group interfaces that will change at the same time into the same assemblies.

提交回复
热议问题