Implementation example for Repository pattern with Linq to Sql and C#

﹥>﹥吖頭↗ 提交于 2019-12-18 02:42:44

问题


I am looking for a Repository pattern implementation example/resource that follows domain driven design principles for my ASP.net MVC application. Does anyone have a good example or learning resource that can be shared?


回答1:


It's not an uncontroversial implementation, but Rob Conery's web storefront project has implemented repository via Linq to Sql in C#.

http://blog.wekeroad.com/

Source is available.

He's not quite doing strict DDD, but his TDD is generally sending him out in that direction. The one caveat is that he has multiple repositories with no aggregate roots, so it's far from a textbook example. Also, earlier implementations of the repository returned IQueryable, so there were no domain boundaries on the repository, which is the source of most of the noise made about his design.




回答2:


Domain Driven Design by Eric Evans is a great place to learn all about the Repository pattern and more. http://dddcommunity.org/books/




回答3:


Here is an article describing an implementation of the repository pattern using Linq to SQL. The full code is open source, available @ github.

http://www.macskeptic.com/living/by/the/code/c/2009/07/02/the-repository-pattern/



来源:https://stackoverflow.com/questions/125453/implementation-example-for-repository-pattern-with-linq-to-sql-and-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!