tags:

views:

42

answers:

4

I have a project with two namespaces, Interfaces, and Services. Each service implements its corresponding interface. Now I need method declarations to include an enum declared for one service. Which namespace do I put the enum in? If I put it in Services, I need to reference Services in Interfaces, which is just ugly. It would be quite neat to pu it in interfaces, but that's not really where enums belong. Suggestions on where to place this enum will be welcome.

+1  A: 

I would recommend a common namespace / assembly referenced by both. Where are your DTOs / Entities defined? This may be the ideal location.

DanP
In the end that made the most sense. I put it in the BusinessObjects assembly. Although it's not a truly business business object, the BO's are actually only DTO's, so neither are they truly business :-)
ProfK
A: 

I would have a common project referenced by both your interface and service projects, which includes types/enums that need to be shared across all projects.

JonoW
A: 

Generally the data access interfaces(repositories) are defined in the same namespace as models. Since the enumeration is a part of the model, it belongs there as well.

Perhaps if you reconsider naming the namespace Interfaces and instead use a more domain specific name - e.g. Clients, Accounts etc, it would feel more natural to define types that interfaces use alongside them.

Igor Zevaka
A: 

In our systems we have a namespace/assembly called Entities which contains all the Interface, Type and Enum definitions. This is then referenced from the Server project (which implements the Interfaces) and also by the Client project (which calls the Server via the Interface). This works really well for our requirements.

barrylloyd