Posted by Eric Polerecky in DDD, mvcMay 17th, 2009 | 4 Comments
I find myself adding child objects within their parents control. For example; if I was going to add a child. I would call the parents controllers addChild action.
/parent/addChild/2
In this case 2 would be the id of the parent that I wanted to add a child to.
Doing it this way I don’t have to keep an internal track of which parent the user wants to add a child to.
For example /child/create does not tell me what parent I am going to associate the child with. In this scenario I would have to put the parent ID in session or something first.
Not sure if what I am doing is “right”….I...
Posted by Eric Polerecky in DDD, Entity FrameworkApr 30th, 2009 | No Comments
I’m really digging the DDD Aggregate root design pattern and thought it would be good to create an example of using EF to pull a root from the persistence layer (database).
My database:
In my little database prjects have releases and stories. releases have sprints and stories and stories have tasks. My root is a project.
My model (EF)
A method for pulling the root:
Its important to note that child objects must be included in the query. ex: Include("Stories.Tasks") will get the tasks.
All the projects
Dim _entities As Entities.EntityFrameworkEntities = New Entities.EntityFrameworkEntitiesReturn...