Question

So for namespacing my repository layer, it's easy. I do something like this:

The interfaces live in Models.Repositories. So maybe I'd have Models.Repositories.IUserRepository or something.

Then I sub-namespace based on what the implementation does. So the implementation may look like so:

Models.Repositories.MySql.UserRepository

How would you do some similar logic with the service layer? Right now I just have my interfaces and implementations in a "Services" namespace, and it looks kinda.. goofy. Like, where would I put some alternate implementation?

Was it helpful?

Solution

This really is up to you, however I like to organize based on name. First on the interfaces, I would have a folder/namespace Interfaces so they are all easily viewable/find/etc.

On the service layer - the exact same way you are doing it.

YourCompany.Project.Services.SomeAlternateImplementation

You may choose to call your interfaces related to your service contracts as well.

YourCompany.Project.Services.Contracts
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top