[Note:  This post is a preliminary version of a document that has been published on the ASP.NET site. The published version with changes resulting from the comments received is now available here. Thanks to everyone who sent comments about this version.]

This is one of a series of posts that present preliminary versions of pages that will eventually be published on MSDN. These pages are a work in progress and suggestions for improvements or corrections are welcome. The intended audience is newcomers to ASP.NET and the purpose is to provide basic guidance for making data access choices for ASP.NET application development. Please forgive the less than ideal formatting -- the HTML for this post was generated by tools that weren't designed for blog publishing. I corrected some of the deficiencies but did not fix all of them.

The series includes:

-- Tom Dykstra
ASP.NET User Education

 

 

This topic provides links to documentation resources about how to access data in ASP.NET web applications.

Scenario Topics

Getting started with data access in ASP.NET

Choosing a Data Access Approach for ASP.NET Web Forms Applications

Getting Started with the Entity Framework

Choosing a Data Access Approach for ASP.NET Web Forms Applications (Includes a section on how to choose a development workflow – Database First, Model First, or Code First.)

Demystifying Entity Framework Strategies: Model Creation Workflow (MSDN Magazine. More information about the development workflows.)

The ADO.NET Entity Framework (MSDN Data Developer Center)

See also the Books about the Entity Framework and Finding current information about the Entity Framework scenarios.

Using the Entity Framework Code First

Getting Started with EF 4.1 using MVC 3 (ASP.NET site. Covers a wide range of Entity Framework Code First scenarios but does not include Migrations. If you want to use EF Code First with Web Forms model binding, start with this and a Web Forms tutorial that uses model binding, such as Getting Started with ASP.NET 4.5 Web Forms - Introduction.)

Introduction to ASP.NET MVC 4 (ASP.NET site. Covers a narrow range of Entity Framework 5.0 Code First scenarios but does include Migrations. For Migrations, see also the Using Entity Framework Code First Migrations scenario.)

Entity Framework Power Tools (Visual Studio Gallery. A tool that lets you use Code First with an existing database by generating the entity classes and the DbContext class.)

DbContext Class (API Reference)

ObjectContext (API reference)

LINQ to Entities

See also the Books about the Entity Framework and Finding current information about the Entity Framework scenarios.

Using the Entity Framework Database First and Model First (the EF designer)

Getting Started with the Entity Framework 4.0 (ASP.NET site. Database First with a Web Forms sample application. This tutorial is now dated but can be used as an introduction to the EF designer and the EntityDataSource control.

Continuing with the Entity Framework (ASP.NET site. Database First with a Web Forms sample application. Includes 3 tutorials on the ObjectDataSource control, 1 on concurrency, one on EF performance, and one on what's new in EF 4.0. Most of the tutorials in this series use techniques that are no longer recommended for new development. Web Forms model binding is now recommended instead of the ObjectDataSource control, and the DbContext API is recommended instead of the ObjectContext API. The last tutorial in the series includes a brief introduction to Model First development.)

Entity SQL Language (Entity SQL is no longer the recommended way to create and execute queries, but it is still used in some scenarios. For example, the EntityDataSource control uses Entity SQL.)

DbContext Class (API Reference)

ObjectContext (API reference)

LINQ to Entities

See also the Books about the Entity Framework and Finding current information about the Entity Framework scenarios.

Loading related data in Entity Framework (lazy loading, eager loading, and explicit loading)

Reading Related Data with the Entity Framework in an ASP.NET MVC Application (ASP.NET Site. Code First, MVC sample application. The methods shown apply also to Web Forms model binding.)

Demystifying Entity Framework Strategies: Loading Related Data (MSDN Magazine)

The Entity Framework and ASP.NET – Getting Started Part 4 - Working with Related Data (ASP.NET site. Database First, Web Forms sample application with the EntityDataSource control.

Maximizing Performance with the Entity Framework in an ASP.NET Web Application (ASP.NET site. Database First. See Efficiently Loading Related Data for information about enabling and disabling lazy loading.)

The Entity Framework and ASP.NET – Getting Started Part 2 (ASP.NET site. See Revising EntityDataSourceControl Markup to Improve Performance for information about the effect on lazy loading of different methods for configuring the EntityDataSource control.

Improving Entity Framework performance

Performance Considerations for Entity Framework 5

Performance Considerations (Entity Framework)

Maximizing Performance with the Entity Framework in an ASP.NET Web Application (ASP.NET site)

Advanced Entity Framework Scenarios for an ASP.NET Application (ASP.NET site. Shows how to execute your own SQL statements or call your own stored procedures, how to disable change detection, and how to disable validation when saving changes.)

Handling concurrency in an Entity Framework application

Handling Concurrency with the Entity Framework in an ASP.NET MVC Application (ASP.NET site. Code First, DbContext API, using an MVC sample application.)

Handling Concurrency with the Entity Framework in an ASP.NET Web Application (ASP.NET site. Database First, ObjectContext API, using a Web Forms sample application.)

Saving Changes and Managing Concurrency (Entity Framework)

Using Entity Framework Code First Migrations

Introduction to ASP.NET MVC 4 - Adding a New Field to the Movie Model and Table

Deploying an ASP.NET Web Application to a Hosting Provider using Visual Studio or Visual Web Developer (ASP.NET site. Tutorial series that shows how to use Code First Migrations to deploy a database.)

Code First Migrations

Web Application Project Deployment Overview for Visual Studio and ASP.NET (See the Configuring Database Deployment in Visual Studio section for an explanation of how Code First Migrations is integrated into Visual Studio web deployment features.

Books about the Entity Framework

Programming Entity Framework: DbContext by Julia Lerman and Rowan Miller

Programming Entity Framework: Code First by Julia Lerman and Rowan Miller

Both of these books are up-to-date with the most current recommended techniques, and they provide a much more comprehensive yet easy-to-follow introduction to the Entity Framework than anything available on the Internet. Another book, Programming Entity Framework by Julie Lerman, is larger and more comprehensive but it is older and many of the techniques it covers are no longer the recommended way to use the Entity Framework.

Finding current information about the Entity Framework

Entity Framework (ADO.NET) team blog

Entity Framework (MSDN Data Developer Center)

Julie Lerman's blog

MSDN Magazine (See the Data Points column, which is frequently about topics related to the Entity Framework.)

Diego Vega's blog

Rowan Miller's blog

Arthur Vickers's blog

Requesting enhancements to the Entity Framework

Entity Framework Feature Suggestions (You can suggest enhancements and you can help prioritize the list of requests for the Entity Framework team by voting on the ones most important to you.)

Using Web Forms Model Binding

Choosing a Data Access Approach for ASP.NET Web Forms Applications (Includes a section on when to use model binding versus data source controls.)

Web Forms Model Binding Part 1: Selecting Data (Scott Guthrie's blog)

Web Forms Model Binding Part 2: Filtering Data (Scott Guthrie's blog)

Web Forms Model Binding Part 3: Updating and Validation (Scott Guthrie's blog)

Model Binding Part 1 - Selecting Data (ASP.NET site video)

Model Binding Part 2 - Filtering (ASP.NET site video)

Getting Started with ASP.NET 4.5 Web Forms - Display Data Items and Details (ASP.NET site)

The blogs and videos are old but are still the best introduction to Web Forms model binding. The Getting Started tutorial is new but does not have very much about model binding in it.

Using Web Forms data source controls

Choosing a Data Access Approach for ASP.NET Web Forms Applications (Includes a section on when to use data source controls versus model binding.)

Data Source Web Server Controls

Using Web Forms data-bound controls and data-binding expressions

Choosing a Data Access Approach for ASP.NET Web Forms Applications (Includes sections on how to choose data-bound controls and data-binding expressions.)

Data-Bound Web Server Controls

Strongly Typed Data Controls (Scott Guthrie's blog)

Strongly Typed Data Controls (ASP.NET site video)

Data-Binding Expressions Overview (This page only covers Eval and Bind; it has not been updated to include Item and BindItem.)

Getting Started with ASP.NET 4.5 Web Forms - Display Data Items and Details (ASP.NET site)

For strongly typed data controls (Item and BindItem expressions), the blog and video are old but are still the best introduction. The Getting Started tutorial is new but does not have very much about strongly typed data-binding expressions in it.

Working with SQL Server databases

Choosing a SQL Server Edition for ASP.NET Web Application Development

SQL Server Connection Strings for ASP.NET Web Applications

Visual Studio 11 and LocalDB - Add New Database Using AttachDb (ASP.NET site video)

Visual Studio 11 and LocalDB - Entity Framework Code First (ASP.NET site video)

Visual Studio 11 and LocalDB - Add and Upgrade an Existing MDF (ASP.NET site video)

The following links apply to SQL Server Express 2008 and have not been updated for SQL Server Express LocalDB.

How to: Create SQL Server Express Edition Databases

How to: Set up an AdventureWorksLT Sample Database for ASP.NET Development

How to: Connect to the AdventureWorksLT Database using an .MDF File

How to: Set Up the Northwind Sample Database for ASP.NET Development

Using LINQ to SQL

LinqDataSource Web Server Control Overview

LINQ Training Videos (Joe Stagner's blog)

Using LINQ queries in ASP.NET applications

Choosing a Data Access Approach for ASP.NET Web Forms Applications (Includes an introduction to LINQ.)

LINQ Training Videos (Joe Stagner's blog)

Using Dynamic Data scaffolding

Choosing a Data Access Approach for ASP.NET Web Forms Applications (Includes a section on when to use the dynamic data project templates.)

ASP.NET Dynamic Data

Securing data access

Securing Data Access in ASP.NET

Security Considerations (Entity Framework)

How To: Secure Connection Strings when Using Data Source Controls

Optimizing data access performance

ASP.NET Performance Overview

Maximizing Performance with the Entity Framework in an ASP.NET Web Application (ASP.NET site)

ASP.NET Caching

Improving ASP.NET Performance (There is a "Retired Content" warning at the top of this page, but most of the information is still relevant and there is no comparable updated resource.)

Improving SQL Server Performance (Same comment as previous link.)

Handling transactions

Managing Connections and Transactions (Entity Framework)

Transactions and Concurrency (ADO.NET)

Debugging data-driven applications

Introducing SQL Server Profiler

Debugging with IntelliTrace

Additional resources

ASP.NET Data Access FAQ

ASP.NET Web Forms Tutorials - Data (ASP.NET site. Most of these tutorials are relatively old; make sure you read Choosing a Data Access Approach for ASP.NET Web Forms Applications first so that you don't get too far into a data access method that isn't right for your scenario.)

ASP.NET MVC Tutorials - Data

ASP.NET MVC 4 Content Map (See the Working with data and the Entity Framework scenario.)

ASP.NET Web Pages Tutorials - Data

Accessing Data in Visual Studio (Provides a list of links similar to this content map but with a focus on Visual Studio rather than ASP.NET.)