Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 24th, 2009, 02:56 PM
mharris mharris is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 10 mharris User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 m 38 sec
Reputation Power: 0
LINQ to SQL - 3 Tier Design

Hi,

I've just started looking at .NET's LINQ to SQL and am very impressed with it, but I have a query about how it should fit into the data access layer of a 3 tier design.

It seems that LINQ to SQL is such a clean and concise technology that it has the potential to completely replace the DAL in an application as it does exactly the same job. Even if the DAL was to remain with LINQ to SQL as its internal workings, the DAL would be such a thin wrapper that it almost seems pointless.

Also, as the generated entity object have the ability to update the database simply by changing their properties, surely this renders the DAL useless.. Or at least provides a path for poorly written code to bypass the DAL?

It seems to me that the best way to use Linq to Sql is to scrap the DAL and allow the business logic layer to interact directly with the DataContext object, but this goes against every software design principle I can think of.

I guess im just a bit confused and looking for some best practice pointers.
Any help would be much appreciated.

Martyn.

Reply With Quote
  #2  
Old November 27th, 2009, 10:02 PM
jwdonahue's Avatar
jwdonahue jwdonahue is offline
Bellevue WA, USA
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: May 2004
Location: Bellevue Washington, USA
Posts: 3,398 jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 6 h 48 m 17 sec
Reputation Power: 886
Quote:
Originally Posted by mharris
It seems that LINQ to SQL is such a clean and concise technology that it has the potential to completely replace the DAL in an application as it does exactly the same job. Even if the DAL was to remain with LINQ to SQL as its internal workings, the DAL would be such a thin wrapper that it almost seems pointless.


LINQ hides a LOT of code from you. Yes, it's basically two thirds of the typical data access layer, thus cutting down on the number of lines of code you have to write, but there are sound engineering reasons for maintaining separation between your domain logic and the DAL, no matter how thin the code is that you have to write in that layer. The whole purpose of the DAL is to insure that underlying data structures can be maintained without impacting the client layer (ie, forcing a recompile of client code). To my knowledge, LINQ does not address this issue. It simply makes embedding SQL code in your C# and VB programs easier to manage.

Quote:
Originally Posted by mharris
It seems to me that the best way to use Linq to Sql is to scrap the DAL and allow the business logic layer to interact directly with the DataContext object, but this goes against every software design principle I can think of.


Such an extraordinary conclusion requires strong theory and data to back it up. What draws you to this conclusion?

Quote:
Originally Posted by mharris
Also, as the generated entity object have the ability to update the database simply by changing their properties, surely this renders the DAL useless.. Or at least provides a path for poorly written code to bypass the DAL?


LINQ is no panacea. It's just the VB/C# equivalent of embedded SQL in C/C++. There may be some applications where a DAL is not required, but then, they wouldn't need one no matter what languages you wrote them in.
__________________
My worst nightmare was a pointless infinite loop.
Work in progress; don't poke the curmudgeon!
http://www.odonahue.com/

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > LINQ to SQL - 3 Tier Design

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap