I have an Invoice
object which has an InvoiceType
. Now, by looking at this situation, InvoiceType
can exist without invoice. Should i treat Invoice
as one aggregate root, and InvoiceType
as another aggregate root within it's aggregate, and connect those to via ID reference, or InvoiceType should just be an entity within Invoice aggregate?
Also, when creating invoice, user must be able to choose Invoice Type from dropdown, which suggests me that it should have it's own repository.
Am I right to treat InvoiceType
as separate aggregate?
Am I right to treat
InvoiceType
as separate aggregate?
If InvoiceType
is an entity, and if two different Invoices
can have "the same" invoice type, then yes - you need to treat InvoiceType
as a separate aggregate, with its own repository, and connect them via ID reference.