Should I start using LINQ To SQL?
Asked Answered
C

6

8

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 .

Christo answered 17/9, 2008 at 9:13 Comment(0)
D
5
  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:

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

Dardar answered 8/10, 2008 at 22:12 Comment(0)
P
2

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.

Precocious answered 30/9, 2008 at 19:18 Comment(1)
A great site to show you how to use Partial Classes, to modify the LINQ to SQL generated source file while still being able to refresh the designer generated source. dotnetslackers.com/articles/csharp/…Dardar
A
1

NetTiers is very good for generating a heavy and robust DAL, and we use it internally for core libraries and frameworks.

As I see it, LINQ (in all its incarnations, but specifically as I think you're asking to SQL) is fantastic for quick data access, and we generally use it for more agile cases.

Both technologies are quite inflexible to change without regeneration of the code or dbml layer.

That being said, used properly LINQ 2 SQL is quite a robust solution, and you might even start using it for future development due to it's ease of use, but I wouldn't throw away your current DAL for it - if it aint broke ...

Apparition answered 17/9, 2008 at 9:20 Comment(0)
O
0

My experience tells me that using by using linq you can get things done faster, however the actual actions to the database are slower.

So... if you have a small database, i'll say go for it. If not, i would wait for some improvements before changing

Omsk answered 17/9, 2008 at 9:42 Comment(1)
How did your experience tell you that 'actual actions to the database are slower?' You should inlcude a description of the performance testing you did so that people know you aren't just making it up.Bluetongue
M
0

I'm using LINQ to SQL on fairly large project right now (about 150 tables) and it is working out very well for me. The last ORM I used was IBatis and it worked well but took alot of legwork to get your mappings done. LINQ to SQL performs very well for me and so far has proved to be very easy to use out of the box. There are definately some differences you have to overcome in transition, but I would recommend it's use.

Side note, I have never used or read about NetTiers so I won't discount it's effectiveness, but LINQ to SQL in general has proven to be an extremely viable ORM.

Marxmarxian answered 30/9, 2008 at 19:25 Comment(0)
E
0

Our team used to use NetTiers and found it to be useful. BUT... the more we used it, the more we found headaches and pain points with it. For example, anytime you make a change to the database, you need to re-generate the DAL with CodeSmith which involved:

  • re-generating thousands of lines of code in 3 separate projects
  • re-generating hundreds of stored procedures

Maybe there are other ways of doing it, but this is what we had to do. The re-gen of the source code was ok, scary, but ok. The real issue came with the stored procedures. It didn't clean any unused stored procedures so if you removed a table from your schema and re-gened your DAL, the stored procedures for that table did not get removed. Also, this became quite a headache for database change scripts where we had to compare the old database structure to the new one and create a change script to update client installations. This script could run into the tens of thousands of lines of sql code and if there was an issue executing it, which there invariably was, it was quite a pain to resolve it.

Then the light came on, NHibernate as an ORM. It certainly has a ramp-up time to it but it is well worth it. There is a ton of support for it so if there's something you need done, more than likely it's been done before. It is extremely flexible and allows you to control every aspect of it and then some. It is also becoming easier and easier to use. Fluent Nhibernate is up and coming as a great way to get rid of the xml mapping files that are needed and NHibernate Profiler provides an excellent interface to see what's going on behind the scenes to increase efficiency and remove redundancy.

Moving from NetTiers to NHibernate has been painful, but in a good way. It has forced us to move into a better architecture and re-evaluate functional needs. NetTiers provided tons of data access code, get this entity by its id, get this other entity by its foreign key, get a tlist and vlist of this and that, but most of it was unnecessary and unused. NHibernate with a generic repository and custom repositories only where needed reduced tons of unused code and really increased readability and reliability.

Ensilage answered 28/4, 2009 at 2:27 Comment(2)
With netTiers you can set it to use paramerterized sql rather than stored procedures. This saves you from the sp mess in the db.Apodosis
Hello, We are working to remove/reduce these overheads and pain points in the next version of .netTiers (v3.0). Thanks -Blake NiemyjskiPatsy

© 2022 - 2024 — McMap. All rights reserved.