4

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
  • Do you mean Linq to SQL? Commented Jun 10, 2010 at 13:25

4 Answers 4

3

Here is a six part article about Architecting LINQ To SQL Applications

Sign up to request clarification or add additional context in comments.

Comments

2

The Repository Pattern is the one I think you're looking for

Comments

1

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.

Comments

1

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 :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.