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.

No Comments