Currently building a CQRS .NET API from scratch, I decided to split my solution in multiple projects, each project representing a layer. I am trying to follow best practices, proper architecture and domain driven design. For information, I have separated my infrastructure and persistence layers in two separate projects.

I encounter an issue and would like to know what are the solutions I could possibly use.

My entities are declared in my domain layer. My Repository Interface is declared in my application layer. My actual repository implementation is declared in my Persistence Layer.

The thing is, if I want to create a UserRepository, based on the User Entity in the domain, then I would need to add a dependency from the persistence project to the domain project and I would prefer that only the application project has access directly to the domain.

Can anyone suggest a solution?

Thanks again.

I thought of creating another layer like Domain.EntityInterfaces which would implement an interface of a component with an "int id". Then my userRepository could use the interfaces of these layers instead.

0

There are 0 best solutions below