That could also mean Comment is a separate aggregate and that would be alrgith too.
On Jan 30, 11:36 pm, "Paul Hinett" <[email protected]> wrote: > Thats the same conclusion i had came to. I may have to sacrifice strict DDD > for a more performant application. > > Thank you for the reply! > > Paul > > Sent from my Nokia phone > > -----Original Message----- > From: Kevin Pang > Sent: 30/01/2010 1:06:42 am > Subject: [nhusers] Re: Aggregate Root + Collections + Updates > > I'm not a DDD expert, but as far as I know you have two options: > > 1. Retrieve the Post from your PostRepository, then iterate over the > Comments to find the correct comment, update it, then save the Post to > cascade the comment change to the database. > 2. Use a CommentRepository to retrieve the correct comment, update > it, then save it. > > Option #2 is obviously more performant, and really more intuitive. > However, it does violate the "only have repositories for aggregate > root" DDD rule. They aren't a silver bullet and forcing your code to > abide by them when a more logical and performant solution exists might > be missing the forest for the trees. > > Kevin > > On Jan 28, 2:57 pm, "Paul Hinett" <[email protected]> wrote: > > Hi, > > > I am trying to setup my domain using strict DDD rules, one of them is > > aggregate roots...how am i supposed to select and update a single item from > > a collection of objects inside my aggregate root? > > > For example say i have a post which is the aggregate root, which has lots of > > comments and i wanted to edit a single comment. How can i get this post from > > the collection, make some changes to it then persist it again? > > > Without using aggregate root i could setup a repository for the comments, > > select one and update it quite easily, but as far as i understand when using > > aggregate roots you shouldn't need a repository for the comments. > > > I am using S#arp arch if that makes any difference. > > > Thank You, > > > Paul > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group > athttp://groups.google.com/group/nhusers?hl=en. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
