CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Grant Killian's Blog

No, this has nothing to do with beer -- but maybe it should?

In Lieu of a 5 day ADO.Net Bootcamp . . .

Since our class is in the middle of the ADO.Net material, I feel it's my responsibility to share some lessons from the real (as opposed to the academic) ADO.Net world; the class material and the Microsoft Press book skirt around a lot of information that is important to any real world development effort.  Honestly, we could devote an entire 14 sessions just to ADO.Net (and WeProgram.Net has talked about offering something like this in a “ADO.Net for Enterprise Applications“ bootcamp format -- shoot me an email if you'd be interested).  Here are some good references I frequently use for ADO.Net . . .

First off, Bill Vaughn does a fine job of pointing out the shortcomings of using the commandbuilder in this MSDN piece; he also discusses some better alternatives for working with databasesPaul Laudeman turned me on to this link several months ago, and I break it out each time ADO.Net comes up in the ITPro curriculum.

Second, Microsoft has provided an open source layer between your ADO.Net objects and your business objects; it's called the Data Access Application Block and you can read all about it here

Instead of writing something like this:
dim cn as new SqlConnection( K_DSN )
cn.Open()
dim cmd as new SqlCommand( sql, cn )
cmd.ExecuteNonQuery()

You can write this:
SqlHelper.ExecuteNonQuery( K_DSN, CommandType.Text, sql )

And that's just the tip of the iceburg; it's a big productivity boost as the SqlHelper class wraps the lower level ADO.Net objects in a more developer-friendly fashion.  I reference it in most of my applications. Microsoft has a number of other Application Blocks for simplifying common development tasks, just search MSDN for "Application Blocks" and you'll turn them up.

Third, this link offers architectural guidelines for data access and serves as a solid real-world reference

Finally, no data acess desicisions should be made without also considering performance.  Here is a detailed treatment comparing various data access alternatives from Microsoft's performance testor/author Priya Dhawan.

This is enough to get you to off to a good start, but I'd be curious to learn what other resources people find useful.



Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add
Check out Devlicio.us!