views:

382

answers:

1

I know that we should only create repositories for Aggregate Roots and not for the entities it aggregates. Should I apply the same logic to MVC, e.g., have a Controller/PageView for an Aggregate Root and then a/some PartialView/PartialAction for the sub-entities.

Please illustrate your answer with the famous Order/OrderLine example.

I am currently using the S#arp Architecture and there is no examples of this.

Edit 1 : I started a thread on the Sharp-Architecture group

+2  A: 

I will take a shot at answering my own question.

First of all, ASP.NET M(VC) and DDD are things that are complementary. The concept of Aggregate Root should not alter or drive the design of the views/controllers. An Aggregate Root is something applied to a (business) model. The views/controllers should deal mostly with simple objects. It may be necessary to create some specific classes (DTOs). Model binding is something cool but the controllers (or Model Binders) should not have the responsibility of creating an Aggregate Root.

What do you think ?

W3Max
I finally found the answer to all (almost) my worries : http://www.lostechies.com/blogs/jimmy_bogard/archive/2009/06/29/how-we-do-mvc-view-models.aspx
W3Max