Blog Stats
  • Posts - 27
  • Articles - 0
  • Comments - 19
  • Trackbacks - 10

 

Implementing the Repository Pattern with Linq-to-Sql

I had too much content for a blog post, so I posted a full article to code project:

http://www.codeproject.com/KB/architecture/linqrepository.aspx

Feedback

# re: Implementing the Repository Pattern with Linq-to-Sql

Gravatar I would not opt for this version of the Repository, as it requires keeping the data context open, which runs contrary to the Repository idea. 8/15/2008 9:11 AM | Gregory Beamer

# re: Implementing the Repository Pattern with Linq-to-Sql

Gravatar Im interested in what you would prefer to do. I scoped the DataContext to a http request which seems to be what most people consider to be the best strategy. 8/15/2008 7:00 PM | Liam McLennan

# re: Implementing the Repository Pattern with Linq-to-Sql

Gravatar There is something that I don’t understand in using LINQ to SQL in Repository pattern :

Let’s say that I will create an assembly for each of the Repository providers (LINQ to SQL, MySQL, Oracle, WebService, XML files etc. etc.). I will define the IRepository interface in a common assembly (let’s call it ‘Interfaces’) that will be referenced by any Repository provider assembly. But where will the entity classes be placed? Since they are generated by Visual Studio or by SQL Metal they would live in the LINQ to SQL provider but they are required in the ‘Interfaces’ assembly so I have a circular problem.

How do I go about this? 10/23/2008 7:49 AM | Andrei Rinea

# re: Implementing the Repository Pattern with Linq-to-Sql

Gravatar I think you have the repository pattern confused. There are no repository providers and linq-to-sql is Sql Server only. You might be thinking of the Provider pattern which is something else entirely. 10/23/2008 5:24 PM | Liam

Post a comment





 

Please add 7 and 5 and type the answer here:

 

 

Copyright © Liam McLennan