开发者

Where should I validate business rules involving 2 or more entities in ASP.NET MVC?

one of my business rules is to check the state of an entity when开发者_开发问答 updating another different, related entity. Where and how should I implement this validation? I know it should be done at the Model, but have not found examples for LINQ-to-SQL and EF. Thank you.


As always, the answer is "it depends".

In my solution, my UI talks to my service layer. My service layer has access to my entities (and their entity-specific logic) and my repository. In the cases where I have logic that operates against multiple entities, I keep it in the service layer. I have to be careful though about leaning too much towards an anemic model where my entities are merely data bags.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜