ASP.NET Data Access Guidance Published

ASP.NET Data Access Guidance Published

Rate This
  • Comments 4

On 9/11 we published a new* set of pages on MSDN offering guidance for getting started with data access in ASP.NET. If you're already using ASP.NET, parts of these pages will just repeat what you already know or take for granted, but a few parts contain recommendations that are new for ASP.NET 4.5. These pages clearly identify which technologies are still available and supported but are no longer part of Microsoft's strategic direction, such that you should think twice before choosing them if you're creating something new. One page provides help setting up SQL Server connection strings.

Here are links to the new pages, with a sampling of what you can find in them:

  • ASP.NET Data Access Content Map
    • Links to Internet resources for data access in ASP.NET, organized by subject.
  • Choosing Data Access Options for ASP.NET Web Applications
    • Choosing a DBMS (choose SQL Server).
    • Choosing a SQL Server edition for development (choose LocalDB for VS 2012, SQL Server Express for VS 2010)
    • Choosing an ORM (choose Entity Framework).
    • Choosing an Entity Framework development workflow (Code First vs. Database First or Model First).
    • LINQ vs. SQL (use LINQ wherever possible).
    • Web Forms choices
      • When to use ListView vs. Repeater vs. GridView controls.
      • When to use DetailsView vs. FormView control.
      • When to use TemplateField vs. BoundField vs. DynamicField controls.
      • When to use the DynamicControl control.
      • When to use data source controls vs. Web Forms model binding vs. manual data binding.
      • When to use Eval and Bind vs. Item and BindItem data-binding expressions.
      • Recommendation to use the new-in-4.5 data-binding expression delimiter (<%#:) for HTML encoding.
      • When to use Dynamic Data project templates.
    • When to use Web API vs. WCF
  • SQL Server Connection Strings for ASP.NET Web Applications
    • Sample connection strings for LocalDB, SQL Server Express, SQL Server, SQL Database, and SQL Server Compact.
    • How to convert a connection string from LocalDB to SQL Server Express and vice versa.
    • How to configure Data Source, AttachDbFileName, Initial Catalog, Integrated Security, MultipleActiveResultSets, and User Instance settings.
  • Using SQL Server Compact 4.0 for ASP.NET Web Applications
    • SQL Server Compact's status compared to other SQL Server editions.
    • Sections on installing, deploying, tools, and migrating to SQL Server.
  • ASP.NET Data Access FAQ
    • When to use Microsoft Access in a web application (don't).
    • Is SQL Server Express OK to use in production (it is).
    • Can you combine the membership database with your application database (yes).
    • How to round-trip web projects with databases between Visual Studio 2010 and 2012 (install SQL Server Express 2008 in Visual Studio 2012).

*Some of these ASP.NET 4.5 pages existed in ASP.NET 4 or earlier versions, but the content is all new. The others are new pages for ASP.NET 4.5.

Feedback is welcome, and this blog is the best place to post comments.

-- Tom Dykstra

  • Typo: Server Explorer in Visual Studio 2012 offers limited database manipulation functionality. You can install this functionality in Visual Studio 2012 SP1 by clicking the following link: Microsoft Visual Studio 2010 SP1 Tools for SQL Server Compact 4.0. - Should be: functionality in Visual Studio 2010 SP1

  • Typo on blogs.msdn.com/.../data-access-guidance-published.aspx: search for "Iinternet" (notice double "I").

    Thanks for the useful guidance, though you're really asking for an EF vs nHibernate war with some of the content.  This might seem to undermine the credibility of the guidance somewhat.  (See ayende.com/.../nhibernate-vs-entity-framework-usage or ayende.com/.../nhibernate-vs-entity-framework-4-0 for an contrasting opinion.)  That being said, we like EF!

  • @ErikEJ, and Oily A - Thanks for finding and reporting the typos.  They'll be fixed with the next MSDN update.  Normally that happens only every 3 weeks, unfortunately.

  • Is there any kind of guidance for the scenario where you want to break the ASP.NET website and the Data Access options you describe above by adding a service layer? i.e. A WCF or MVC WebAPI web service that utilizes EF and then an ASP.NET website that consumes the web service as its backend instead of directly referencing the data layer.

Page 1 of 1 (4 items)