.NET Answers

ASP.NET, HTML, CSS, Visual Studio, CSharp, VB.NET and other programming items of interest.
Subscribe
  • Home
  • About Me
  • Advertising
  • Click Here to Ask a question
    • Privacy Policy
  • Site Map

Is LINQ Multi Layered?

February 18, 2008 By: Dave

Several weeks ago, we discussed the point of Multi-Layered Architectures.  We discussed what a multi-layered architecture looks like, and the problems it solves.

Today, what I want to examine is the question, “Is the LINQ model we’ve been looking at since then really multi-layered?”

So, the first thing we should examine is obviously, does it look multi layered on the surface?  I guess that really depends on how you look at LINQ.  My first tendancy was to view the LINQ to SQL classes and the extension points as two different layers.

image

But, on closer inspection, I think what we really have is this:

image

To a large extent, it is the attributes of the LINQ 2 SQL classes that are controlling the access to the database.  The methods are the conduit between the presentation layer and the data access layer.

So, yes, it looks multi-layered.

So, does it meet the other criteria we setup?  Does this model solve all of the problems?

  • Does it keep business logic out of the presentation layer?

Well, it almost does this?  If you ask me, Microsoft has a pretty funky implementation for using a SELECT stored procedure that pretty well forces the call into the presentation layer.  Further, you could add filtering code in the event handler that would force more BLL code into the presentation layer.  The SELECT method would have been better implemented like the INSERT/UPDATE/DELETE methods in the LINQ 2 SQL classes.

  • Does the DAL only have code in it that gets data out of the database?

Yes, since Microsoft is doing all of this for us via the attributes, this is pretty well separated.

  • Does the BLL allow us to validate our data on the way down to the database?

Yes, this has been well implemented via the extension points.

  • Does the BLL allow us to translate our data as we move it from the DAL to the View and back again.

Yes, again, this is allowed by using extension points.

  • Can we swap out the presentation layer?

Yes, we should be able to do this without much trouble.

  • Can we swap out the DAL?

No, LINQ 2 SQL is pretty well tied to MS-SQL.

  • Can we place each of the layers on different computers?

No, but this does not mean it is not multi-layered.  It only means that we can’t use it in a mult-tiered implementation.  The ideal would be for it to do both.

So, we have one place in LINQ 2 SQL where it fails true multi-layered capabilities and another nice to have that we’ve lost. 

Does it matter?

If all you are building is web sites that use MS-SQL for the database, it probably doesn’t matter.  While I would not call this a multi-layered architecture, it is a functional architecture for building web applications that don’t have a completely unorganized mismatch of code that no one would know how to maintain if they were not the ones who had written it.

However, if you are planning to use the same code base for web applications and other applications, like windows forms, or you need this to work with multiple databases, you may need to provide a few tweaks to this model so that it will work for you, instead of against you.

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Related Post

  • Document/View All Over Again…
  • Using StoredProcedures with LINQ 2 SQL Classes
  • Computed Columns Using LINQ to SQL Classes
Bookmark to:

Add to Del.icio.us Add to digg Add to DotNetKicks Add to DZone Add to Facebook Add to Slashdot Add to Stumble Upon Add to Technorati
Hide Sites
Tags: asp.net, linq, multi-layered, sql, visual studio

Comments are closed.

← Using StoredProcedures with LINQ 2 SQL Classes
Jott This →
  • Search

  • Subscribe

    U COMMENT
    I FOLLOW

    Subscribe in a reader

    OR

    Subscribe via e-mail

    Enter your email address: 

    Delivered by FeedBurner

     

  • Follow Me

    • Twitter
    • FaceBook
    • Digg
    • StumbleUpon
    • Propeller
    • Delicious
    • Plaxo

     

  • Recent Posts

    • ASUS Eee PC 1005HA-PU1X-BK Black Netbook
    • jQuery – Date Picker
    • Using VB.NET From CSharp
    • iTextSharp – Adding Images
    • Hungarian Notation – Use What Works, Spit Out The Bones
    • Pre Order Windows 7
    • jQuery Dialog – With Validation Controls
    • iTextSharp – The easy way
    • Structure of my ASP.NET Web Applications
    • 35% Off Accronis True Image 2009 Home
    • VB.NET Hide Module Name
    • ASP.NET/VB.NET – Video Training
    • Does jQuery Make Us Lazy?
    • PDFs Using iTextSharp
    • Programming SEO – Ping



  • Advertise on this site through Lake Quincy Media
  • DotNetNuke Sponsor

     

    Most Valuable Blogger
  • Sponsor

  • Categories

    • Advanced CSharp
    • Advanced VB.NET
    • ASP.NET MVC
    • Did you know
    • DotNetNuke – Module Development
    • DotNetNuke – Skinning
    • internationalization
    • iTextSharp
    • jQuery
    • none
    • Seach Engine Optimization
    • Silverlight
    • SQL For Programmers
    • Twitter
    • winforms
  • Cloud

    .net ajax architecture asp.net book books containers csharp css dal dataset datasets dotnetnuke events gridview images internationalization internet explorer javascript jQuery json linq listview modules ms-sql MVC objectdatasource programming reflection seo Silverlight skinning sql testing tsql tutorial Twitter twitterizer vb.net video view Vista visual studio webservice WordPress
  • Archives

    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
    • January 2008
    • December 2007
    • November 2007
    • October 2007
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
    • Privacy Policy
  • Calendar

    February 2008
    S M T W T F S
    « Jan   Mar »
     12
    3456789
    10111213141516
    17181920212223
    242526272829  
  • Blogroll

    • Alvin Ashcraft’s Morning Dew
    • ASP.NET Consulting
    • Life Hacker
    • Remember Anything
    • The Price of Their Toys
    • Uncategorized Thought


.NET Answers © 2007 - 2008 All Rights Reserved.
Entries and Comments.