Where should I define Enums?

Posted by Ciel on Stack Overflow See other posts from Stack Overflow or by Ciel
Published on 2010-05-07T03:29:09Z Indexed on 2010/05/07 3:38 UTC
Read the original article Hit count: 189

Hi:

I'm setting up a new app, with a Repository layer/assembly, a Services layer/assembly, and a UI assembly.

So I end up with namespaces such as:

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

And then I have enums for the args that are used by all 3 layers. Only place that makes sense is to put them in the Cross cutting assembly. (define them in Data layer too low, as UI should have no direct ref to them, defined in Services, too high for Repository layer, which shouldn't be referencing upwards).

But...which namespace in Common? Namespaces should mostly be used to define concerns, rather than Type... I've always used something like:

namespace App.Common.Enums {...} 

but it's always felt a bit of a hack that works for me, but not well in a large org where everybody is generating Enums, and if we put them all in Enums folder it's going to make the code folder harder to understand later.

Any suggestions?

© Stack Overflow or respective owner

Related posts about application-architecture