1

I am looking to understand and implement the Onion Architecture and have a vague idea on how to structure everything but need help to clear up some of my confusion.

Onion Architecture

Based on different examples and articles I Have read I created the above structure. One of my main confusion comes when I look at "02-Service: Services Interfaces". Lets take the IUserService.cs. I assume this interface would contain different signatures like RegisterUser(), LoginUser(), BanUser(), ModifyUser(), ChangeAuthenticationLevel() and so on? Is this correct? If not what other examples would we find? And are these considered Domain Services or Application Services?

1

I assume this interface would contain different signatures like RegisterUser(), LoginUser(), BanUser(), ModifyUser(), ChangeAuthenticationLevel() and so on? Is this correct?

No it is not. See, how there is User in each of those methods? That means it operates on user, and thus is part of the User entity. And as such, they should all be methods on User class and not part of service. Actually, from DDD perspective, Service is still part of the domain. It contains behavior that does not belong to any entity, but something like that should be extremely rare. For example, Repository is specific type of service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.