I have a C# N-Layer Project that has 5 Layers: 1-Infrastructure 2-Domain 3-AppService 4-Distributed Service 5-Presentation
I want to use enums in my project. but I don't know which layer describe them. I have two ideas about it.
1- declare enums in Domain and pass through network by WCF DataContract.
2- declare enums in a class library project(ex: in common layer) and build it as dll and use it in all layer.
Help me to choose one.
It depends on where you need to use the values that the enum's represent. If these are values that your presentation layer would need, then that is where they should go. If it is something that your service layer would rely on, then you need to put them in there.
I'm not to sure the best approach is to lump all of your enums into a single location. They should be spread-out across the app, at the lowest layer that relies on them, usually in the same namespace as the class that consumes the enum and performs some logic on them.
If the app and the domain will use them, then declare them in the domain and pass the value through the network.