Should I have a separate database for each domain in DDD? EF MVC codefirst

I am so new to DDD. I have a project with 6 domains. enter image description here

In each domain, I have my inf and app layer. My question is about my database. First I use Entity Framework Code (MVC ASP). Do I have to create a separate database for each domain?

+3


source to share


1 answer


You've managed to split your application into multiple bounded contexts ( BCs

), one for each domain (subdomain). This is the ideal situation.

In this case, you should have separate databases (or at least separate tables / collections) for each bounded context. To share data from one BC

to another BC

, you must use a context mapping strategic DDD template to find out which is the best (depending on your architecture, you can use a layer of anti-corruption to data sharing between upstream and downstream bodies BC

).



Read more here about the types of integration between BCs

.

PS. In the book of the domains project Distilled from Vaughn Vernon you can find examples of integration.

+3


source







All Articles