Data Driver

Blog archive

.NET Data Access In Web Apps 101

Ever wonder what all these new-fangled data-based technologies coming from Microsoft can do for you? Who can keep track of everything? There's ADO.NET, LINQ to SQL, ASP.NET MVC, Entity Framework and OData, to name a few. Not to mention the code names and name changes: Oslo is now SQL Server Modeling; Gemini is now PowerPivot; ADO.NET Data Services is now WCF Data Services; and of course, my personal favorite, ADO Data Services v1.5 is now Data Services Update for .NET Framework 3.5 SP1. The list goes on.

Well, for you Web devs, I found a great primer from last week's MIX10 conference in Las Vegas. It was in a session called Accessing Data in a Microsoft .NET-Connected Web Application.

A great service from Microsoft was putting the MIX10 sessions on video for those of us who couldn't go to Vegas because of outstanding warrants, etc. (JK; never been there).

Shayam Pather provides an excellent, step-by-step, hands-on demo starting out with the most basic .NET data access and ending with the new darling debutante, OData.

He writes some simple code, then looks at the patterns used in the code and shows you how to simplify/improve things by using new, "fancier" approaches and patterns.

For example, he starts with an empty ASP.NET MVC project in Visual Studio 2010 and quickly shows "the simplest way we can get data access going" with a connection string, select command, data reader and a little HTML.

After he does "the MVC dance" over this inline code, he points out the advantages of using model, view and controller to separate the data from the presentation from the mediator between the two. Any one can be changed without affecting the others.

He goes on to tackle a basic feature of the ADO.NET Entity Framework (ExecuteStoreQuery) that gets you into simple EF stuff by retrieving strongly typed objects out of your queries without having to deal with ORM or other modeling.

It proceeds in complexity from there. One of the better parts of the video shows how a model can reduce a complicated SQL query with an inner join, left outer join, filter, etc., to some simpler code that even I can understand (the best part is actually a joke commemorating St. Patty's Day: "An Irishman walks into a bar..."). At the same time, he shows how much easier it is to deal with the results of the query and bounce from one slice to another.

That, my friends, is what these new-fangled data-based technologies from Microsoft can do for you.

It can be intimidating to tackle new technologies and abandon the tried-and-true tools you've used for years. But when you do, the rewards can be great. Check out the video. (That's the only way you'll see the punchline of the Irish joke.)

Have you tried some of this new data stuff? Has it helped? Tell me your story. Comment here or send me an e-mail.

Posted by David Ramel on 03/25/2010


comments powered by Disqus

Featured

Subscribe on YouTube