I am working in a DDD based application architecture. I have the following scenario.
I imported from BizTalk Invoices from another system. This provide an structure that I reflect internally in the application like the following graph:
Throught a Heavy Background Billing Process the graph grows and create a structure like the following one (And now it is the final model):
Finally I would need to use those BillingDocs in grids and realize if a BillingDoc have an InvoiceHeader and details imported from the external system by iterating a lot of billingdocs and its graph which worries me.
How can I do those operations as part of my domain model without affecting the performance given I will be iterating every single document and the large graph.
What I did was to flag the Aggregate Root if when creating the documents it had that InvoiceHeader. So when I need to iterate I avoid digging through the large graph.
Do you have any suggestions on how can I do to improve that process and keep my domain right? What do you think about my solution? does it violates ddd ?
Thanks a lot.
I think you need to clearly distinguish between your presentationObjects and Domain Objects, if you are truely following DDD. If you are thinking of exposing Domain objects towards UI then I think, such questions will arise and would be really difficult from performance etc. persepctive.