开发者

Linq to SQL and ASP.NET MVC 3 Integration

How tightly can the ORM data classes generated by LINQ to SQL be integrated with the Model layer in MVC? Could these ORM data classes act directly as the model, if so, how would validation occur a开发者_运维技巧s it is usually done in MVC 3 with DataAnnotations? It seems that it would be diffiult to add these to the generated classes.


Separation of Concerns suggests that the classes that make up your domain model shouldn't be dependant on the technology that's used to implement your Data Access Layer, so I make every effort to ensure that they're not propogated through the UI.

If you use Entity Framework instead of Linq-to-SQL, you can use the POCO generator instead of EF's default EntityObjects. While these are still generated from the EF database model, you can replace the data access implementation but retain the POCO's for your domain model.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜