开发者

best way to delete related entity in repository

say you have a repository BusinessRepository and you want to have some meth开发者_C百科od that deletes a given BusinessContact, in this scenario Business is the parent and BusinessContact is the child, one to many, each business can have many contacts, would we have two deletes method in same repository? or put it in the Update method. I am using C# and EF 4. Thankx


Sounds like Business is an aggregate root.

So, i would suggest Adding and deleting contacts through methods on your Business entity which you get using your repository.

Info on Repository Pattern and aggregate roots: What's an Aggregate Root?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜