I am building a c# - linq - sql server winforms/asp.net application, accessing a database. I would like my business logic layer to be easily testable, and that means not littering it with Linq database queries everywhere. What design patterns/ best practices are available for the following use cases - inserting/updating a new object - searching for an object - loading a bunch of related data into a sort of "presentation" object that could be displayed by various views ?
+1
A:
I recomend to view video lessons http://www.asp.net/mvc/videos#ASP.NET%20MVC%20Storefront%20Starter%20Kit Part 1-3 about services/repositories/filters. It's good solution.
Maksim Kondratyuk
2010-06-10 13:29:41
+1
A:
Look into putting your database calls into a set of classes implementing a common interface (Repository pattern is a common way to do this). Then you can mock these objects when running tests. Just make sure the repositories themselves are tested somewhere too :)
AlexCuse
2010-06-10 13:30:47
+2
A:
Here is a six part article about Architecting LINQ To SQL Applications
Giorgi
2010-06-10 13:33:47