views:

112

answers:

3

hey all, Im working on an ASP.NET app and using LINQ to SQL for the first time and something seems off. Usually on a web project, there is a data access layer, a biz layer and the preso layer....does linq to sql not work this way? I see where other developers have put the DataContext directly into the Preso layer and are calling the DB via linq from there. Is that the correct way to do it? no biz layer? Thanks John

A: 

You can encapsulate LINQ in a data access layer. But for most small to mid size projects, it's good enough.

You should always have the high level goals in mind. You use object orientation and design patterns to lower the cost of implementation and maintainability. There is no need to overengineer when the simplest and fastest design satisfies most of the needs and is maintainable enough.

Mehrdad Afshari
+1  A: 

If you are looking for more layers of abstraction between you and the database, perhaps LinqToSql is no the right choice for you. Perhaps the ADO.NET Entity Framework is a better choice.

Andrew Hare
A: 

An usual practice is also to implement the Repository pattern:

CMS