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

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

  • What's New for Python, Java in Visual Studio Code

    Microsoft announced March 2024 updates to its Python and Java extensions for Visual Studio Code, the open source-based, cross-platform code editor that has repeatedly been named the No. 1 tool in major development surveys.

Subscribe on YouTube