LINQ-SQL: Why I Love it and why I hate it

Love it:

  • Generate a class structure based on database tables.
  • Makes coding transactions really easy and seamless.
  • Makes working with store procedures more like methods.
  • Makes it easier to validate database field names at compile-time.

 

Hate it:

  • Object must be “attached” and “detached” in different situations.  This is silly.  We should be able to get an object, pass it any tier of the app and attach it to any DataContext more easily.  We should NEVER have to leave the DataContext object open.
  • Order of operations: if I call a Delete and then an Insert, the generated SQL may not be in that order.  That’s nasty.
  • Too easy to use:
    • This should be a love it, but is more of a hate it, since now I have to police my developers to make sure they aren’t writing inadvertent database queries that are nasty.  I guess they could always do this, but now it’s even easier, so it happens more often.
  • Mass delete/update operations: the dynamic sql for this is nasty.  You need to write a stored proc or your own dynamic sql to make this efficient.
  • Temp table handling in stored procs.  Stored procs that use temp tables don’t work worth a hoot.  This stinks.
  • It’s slower then traditional database querying.  Mind boggling.  I hope it gets a performance boost in 4.0.

 

I have lots of others love/hate things for LINQ-SQL, but these are the ones that stick in my head…

 

More later, joel.

Published Monday, April 06, 2009 3:07 PM by joelvarty
Filed under: , ,

Comments

# re: LINQ-SQL: Why I Love it and why I hate it

Tuesday, April 07, 2009 11:51 AM by Eric J. Smith

You really should take a look at PLINQO.  It's a set of CodeSmith templates for LINQ to SQL that addresses many of your concerns like detaching and re-attaching to a different context instance and mass update and delete operations.  We have recently setup a website for PLINQO at http://www.plinqo.com/

Leave a Comment

(required) 
(required) 
(optional)
(required)