0

I have two aggregate root :

Event :


Id - name - title - categoryId

Category :


Id - CategoryName

These model are separate aggregate roots in my project.and i have a viewmodel from these models(asp.net mvc) :

EventViewModel:


Id - name - title - CategoryId - CategoryName

Problem : because these are separate aggregate root then i cant't use navigation property . and reference by id(categoryId).so what is best solution for map viewmodel?

  • join query in entityframework?
  • navigation property?
  • change view model by combine 2 models and map them separely(coupling)?

thanks,

Davood Mir
  • 17
  • 6
  • I guess you can join `ID` in Category and `CategoryID` in Event. – Mairaj Ahmad Jun 13 '16 at 07:26
  • Is this common problem ? or it is for my design . I searched too much but can't find a nice solution.Is join between two aggregate root is best practice? – Davood Mir Jun 14 '16 at 10:49
  • The best practice is to use navigational properties to get to the related items. That's a very simple and common use case. – Steve Greene Jun 14 '16 at 16:19
  • Yes , but these models are in separate aggregate root.and should reference by id .these aren't parent and child in one aggregate.Whether I'm wrong? – Davood Mir Jun 14 '16 at 17:19

0 Answers0