views:

17

answers:

1

Having just started working on a new project using Entity Framework 4, I spoke to some of the other team that use NHibernate for advice. They implement aggregate routes on their entities, so instead of adding an order through the orders entity, they would add it through customer.order by having an addOrder method on customer.

This is the approach I have taken but I am, alas, running into problems. These are issues that I hope to work out, but it got me thinking ... Is this a good way to work or am I fighting an uphill battle unnecessarily?

+1  A: 

You can certainly use the EF this way. Read Eric Evans's Domain Driven Design for more on the idea.

You don't need to write any code for it, though. There will already be a customer.Orders.Add(o) method, to use your example.

Craig Stuntz