Sunday, June 28, 2009
On my recent blog post, I demonstrated that I'd been able to submit the same LINQ query to both an in-memory repository and a L2S Repo.

However, after discussing this on StackOverflow, it seems that we must be careful.  While I have seen this technique demonstrated in other articles, I've not found anything from an official perspective, so I will probably err on the side of caution with this one.

While L2O and L2S may overlap on 90% of cases, that 10% is always going to be the one to bite you when you don't have time to react.  So, it's back to a simpler approach.

I'm still going to stick with the Repository pattern, but instead of exposing the Repository as IQueryable<T> (even if the underlying source is IEnumerable<T>) I'm going to encapsulate the actual queries within a Fetch(ICriteria) method instead.  This worked well for me in a previous application, but it has the obvious drawback that we have to define the queries differently for each Repository implementation.

However, it still allows us to abstract our DAL from our Application layer, as shown in this simple diagram:





So we can still use a Domain Driven approach to developing our app, which is great, but we have to ensure that integration testing is thorough when we introduce our other implemented repositories.

Sunday, June 28, 2009 12:21:14 PM (GMT Standard Time, UTC+00:00) | Comments [0] | Database | TDD#
Search
Archive
Links
Categories
Admin Login
Sign In
Blogroll