Where should I identify Enums?

I am setting up a new application with a repository layer / assembly, services layer / assembly and user interface assembly.

So, I end up with namespaces like:

App.UI App.Biz.Services App.Data.Repositories

And then I have enumerations for the arguments that are used by all 3 layers. The only place that makes sense is to put them in the Cross mounting section. (define them in the data layer too low, since the user interface should not have a direct link to them defined in the services, it is too high for the repository level, which should not link up).

But ... what is the namespace in Common? Namespaces should mainly be used to identify problems, not type ... I always used something like:

namespace App.Common.Enums {...} 

but it always felt a bit hacked, which works for me, but not very well in a large organization where everyone generates Enums, and if we put them all in the Enums folder, it will make the code folder more difficult to understand later.

Any suggestions?

+4
source share
2 answers

I usually recommend a dedicated assembly for general enumerations, interfaces, and value objects. App.Interop or App.Shared or App.Data.Values will be my namespace recommendations.

+2
source

What I did was build the Contracts, and all that is in the root namespace of the applications. I would put the usual things like Enums, which everyone needs access to, in this Contracts DLL.

Another good use for this place is interfaces.

0
source

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


All Articles