Reputation: 45
I'm trying to model two type of invoice in ddd. Purchase invoice and sales invoice. Simply behaviour is purchase invoice increases stock quantities and sales invoice decreases. Which one is rigt for ddd? 1- Defining PurchaseInvoice and SalesInvoice separately that implement business logic in two different aggregate? 2- Defining one Invoice aggregate and implement business logic help with dicriminator field?
Upvotes: 0
Views: 123
Reputation: 4758
Sounds to me like Purchase
and Sales
are two completely different Bounded Context. Which means that an Invoice
Entity could exist in both. A discriminator is a smell that you're dealing with two different things. So neither 1 or 2 seems to be the best option. I'd rather go with an Invoice
in the Purchase
Bounded Context and an Invoice
in the Purchase
Bounded Context.
Upvotes: 2