DEV Community

Discussion on: Domain-driven Design (DDD): File Structure

Collapse
 
stevescruz profile image
Steve Cruz • Edited

I do not have experience with monolithic architecture, only with microservices. I'd recommend using DDD in a microservice with your use case.

In my situation it allowed me to change from MongoDB to PostgreSQL without a hassle since the infrastructure layer was separate from the domain.

I use dependency injection to inject the repository implementation (infrastructure layer that is related to the database) onto my repositories and services (both part of the domain layer), so when I needed to change from MongoDB to PostgreSQL it was only necessary to change things in the infrastructure layer such as the repository implementation and some other minimal things like the database connection. In the end the repository and the services were unchanged.

So I strongly recommend you to use DDD with Dependency Injection and Liskov Substitution principle.

Show this to your colleagues: docs.microsoft.com/en-us/dotnet/ar...