Should I have a separate database for each domain in DDD? EF MVC codefirst
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.
source to share