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

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube