ADO.NET Visual Studio 2010 Data Model vs Linq to SQL

What's the difference between the two? At first glance, they seem to have the same functionality. Who has better performance that is easier to use?

+2


source to share


2 answers


Using ADO.NET and some kind of SQL:

  • Advantage: Doesn't require any configuration or simulation.
  • Advantage: Better if you know how to write and optimize SQL. It's quicker to get started and easier to optimize the road when needed.
  • requires: more sql knowledge (not too bad).
  • requires: a little infrastructure / toolkit to reduce repetitive coding.
  • argument: If you are good at sql, you have a good data access tool, and immediately send your data somewhere else as soon as you get it, there is nothing attractive about Linq-to-SQL ...

Using Linq-to-Sql

  • Advantage: Can be quite easy to read / understand even with limited linq experience.
  • Advantage: Can quickly give you strong types that you can work with right away.
  • Benefit: More often you find your errors in Visual Studio before or at compile time. With plain old ado you will encounter runtime errors.
  • required: schema setup
  • requires: linq knowledge (which you want to have anyway)
  • Argument in favor: Many people think Linq's performance score is not that great and ultimately not a problem. Also, sql linq appears sometimes better than you imagine, even if you imagine sql pro. (Stackoverflow is a large site and Linq-to-sql seems to hold up just fine .)


In short, both are pretty good. The key factors are:

  • Your Skills : If you are good at SQL (and code generation), there is less of a reason for using Linq-to-SQL.
  • You have problems loading db : if you dont have to share a small database server other solutions and you are not huge, Linq-to-Sql - many powerful enough.

Being good at SQL will be important for a long time to come. And while improving LINQ, this is a really good move. Linq-to-XML and Linq-to-Objects are fantastic technologies, and the skill with one flavor translates right into other Linq flavors.

+7


source


The big benefit to me is that you get a free, free object model for your database, without having to write redundant "make an object like this table" and even more redundant "fill this object with data" code.



He's not perfect, but he sure saves a lot of time.

+1


source







All Articles