LINQ : Why hardcode anything?

By tim

Man, this LINQ stuff is amazing

I was dubious at first, to be honest.  I'm confortable with SqlCommand and the logic required to build relational data with Foreign Keys and Cascade delete ; "Who needs another data access language??", I said

The more I use LINQ, the more I'm glad it's here.  I did some old school SqlCommand stuff yesterday afternoon, normalising a flat data structure into something a bit more updatable.  Sqlcomands for every different insert, multiple parameters and data types, cycling through DataSets and filling the data as I went.  The debug was a total nightmare with all the hardcoded parameter names and insert statements

The fruit really materialised when I re-did the data access for the site in question.  Strongly-types objects which would only accept normal data, automagically created List<> of related data, so easy to update and even transaction to boot. 

LINQ does enforce a strict data layout and naming convention, but its well worth it

/never looks back!!

Related posts