Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I start using LINQ To SQL?

Currently I am using NetTiers to generate my data access layer and service layer. I have been using NetTiers for over 2 years and have found it to be very useful. At some point I need to look at LINQ so my questions are...

  1. Has anyone else gone from NetTiers to LINQ To SQL?
  2. Was this switch over a good or bad thing?
  3. Is there anything that I should be aware of?
  4. Would you recommend this switch?

Basically I would welcome any thoughts .

like image 374
Rippo Avatar asked Sep 17 '08 09:09

Rippo


2 Answers

  1. No
  2. See #1
  3. You should beware of standard abstraction overhead. Also it's very SQL Server based in it's current state.
  4. Are you using SQL Server, then maybe. If you are using LINQ for other things right now like over XML data (great), Object data, Datasets, then yes you should could switch to have a uniform data syntax for all of them. Like lagerdalek mentioned if it ain't broke don't fix it. From the quick look at .netTiers Application Framework, I'd say if you already have an investment with that solution it seems to give you much more than a simple Data Access Layer and you should stick with it.

From my experience LINQ to SQL is a good solution for small-medium sized projects. It is an ORM which is a great way to enhance productivity. It also should give you another layer of abstraction that will allow you to change out the layer underneath for something else. The designer in Visual Studio (and I belive VS Express also) is very easy and simple to use. It gives you the common drag-drop and property-based editing of the object mappings.

@ Jason Jackson - The Designer does let you add properties by hand, however you need to specify the attributes for that property, but you do this once, it might take 3 minutes longer than the initial dragging of the table into the designer, however it is only necessary once per change in the database itself. This is not too different from other ORMs, however you are correct that they could make this much easier, and find only those properties that have changed, or even implement some kind of refactoring tool for such needs.

Resources:

  • Why use LINQ to SQL?
  • Scott Guthrie on LINQ to SQL
  • 10 Tips to Improve your LINQ to SQL Application Performance
  • LINQ To SQL and Visual Studio 2008 Performance Update
  • Performance Comparisons LINQ to SQL / ADO / C#
  • LINQ to SQL 5 Minute Overview

Note that Parallel LINQ is being developed to allow for much greater performance on multi-core machines.

like image 104
Steve T Avatar answered Sep 28 '22 06:09

Steve T


I tried to use Linq to SQL on a small project, thinking that I wanted something I could generate quickly. I ran into a lot of problems in the designer. For example, anytime you need to add a column to a table you basically have to remove and re-add the table definition in the designer. If you have set any properties on the table then you have to re-set those properties. For me this really slowed down the development process.

LINQ to SQL itself is nice. I really like the extensibility. If they can improve the designer I might try it again. I think that the framework would benefit from a little more functionality aimed at a disconnected model like web development.

Check out Scott Guthrie's LINQ to SQL series of blog posts for some great examples of how to use it.

like image 44
Jason Jackson Avatar answered Sep 28 '22 06:09

Jason Jackson