ASP.NET Data Access Content Map
This topic provides links to documentation resources about how to access data in ASP.NET web applications, primarily by using the Entity Framework and SQL Server.
This topic contains the following sections:
Getting Started with Data Access in ASP.NET
Using the Entity Framework
Using Entity Framework Code First
Using Entity Framework Code First Migrations
Using Entity Framework Database First or Model First (the EF Designer)
Loading Related data in Entity Framework (Lazy Loading, Eager Loading, and Explicit Loading)
Optimizing Entity Framework Performance
Handling Concurrency in an Entity Framework Application
Books about the Entity Framework
Additional Entity Framework resources
Data Binding in ASP.NET Web Forms Applications
Using Web Forms Model Binding
Using Web Forms Data Source Controls
Using Web Forms Data-Bound Controls and Data-Binding Expressions
Working with SQL Server Databases
Working with SQL Server Express LocalDB Databases
Working with SQL Server Express Databases
Working with Windows Azure SQL Database
Choosing between SQL Server and Windows Azure SQL Database
Working with NoSQL Database Management Systems
Using LINQ queries in ASP.NET Applications
Using Dynamic Data scaffolding
Securing Data Access
Optimizing Data Access Performance
Deploying a Database
Accessing Data through a Web Service
Additional Resources
Get Started with ASP.NET & ASP.NET MVC (If you haven’t worked with ASP.NET, start here for a basic introduction.)
Relational database (Wikipedia site. If you haven’t worked with relational databases, see this page for an introduction to relational database terminology and concepts. For an introduction to SQL Server in particular see Working with SQL Server databases later in this topic.)
ASP.NET Data Access Options (An introduction to data access options for ASP.NET and guidance on how to choose the ones that are appropriate for your scenario.)
Entity Framework Development Approaches (Guidance on how to choose an Entity Framework development approach Database First, Model First, or 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.)
Introduction to ASP.NET MVC 4 (ASP.NET site. Covers a narrow range of Entity Framework Code First scenarios but does include Migrations. For Migrations, see also Using Entity Framework Code First Migrations.)
Model Binding and Web Forms (tutorial series)
Getting Started with ASP.NET 4.5 Web Forms - Introduction. (ASP.NET site. This tutorial set is not mainly about how to use Entity Framework but it includes tutorials that use Code First.)
Entity Framework - Code First to an Existing Database (Video and walkthrough that shows how to use Code First with an existing database.)
Data Developer Center - Entity Framework
See also Books about the Entity Framework and Additional Entity Framework Resources.
Introduction to ASP.NET MVC 4 - Adding a New Field to the Movie Model and Table (ASP.NET site.)
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.)
Data Developer Center - Code First Migrations
Web 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.)
For current resources on using the Entity Framework designer, see the MSDN Data Developer Center. See also the Books about the Entity Framework and Other Entity Framework resources sections in this document.
The following resources are older. They are useful if you want to use version 4.0 of the Entity Framework, and you want to use a data source control for data binding in a Web Forms application.
Getting Started with the Entity Framework 4.0 (ASP.NET site. Shows how to use the EntityDataSource control.
Continuing with the Entity Framework (ASP.NET site. Shows how to use the ObjectDataSource Control. Includes a tutorial on concurrency handling, a tutorial on EF performance, and a tutorial on what's new in EF 4.0.
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.)
Data Developer Center - Loading Related Entities
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.)
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. Applies to Entity Framework 4.0.)
See also Optimizing ASP.NET data access.
Handling Concurrency with the Entity Framework in an ASP.NET MVC Application (ASP.NET site. Code First, DbContext API, using an MVC sample application.)
Data Developer Center – Optimistic Concurrency Patterns
Handling Concurrency with the Entity Framework in an ASP.NET Web Application (ASP.NET site. Applies to Entity Framework 4.0. Database First, ObjectContext API, using a Web Forms sample application.)
Programming Entity Framework: DbContext by Julie Lerman and Rowan Miller
Programming Entity Framework: Code First by Julie 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.
Entity Framework (ADO.NET) team blog (One of the best resources for the most current information and announcements of new enhancements.)
Julie Lerman's blog (Julie Lerman is the author and co-author of several Entity Framework books and courses, and her blog is another good source for current information and announcements.)
MSDN Magazine (See the Data Points column, which is frequently about topics related to the Entity Framework.)
The following blogs are by members of the Entity Framework team at Microsoft. They are not as frequently updated as the team blog.
ASP.NET Web Forms Data Access Options
Model Binding and Web Forms (ASP.NET tutorial series)
Web Forms Model Binding Part 1: Selecting Data (Scott Guthrie's blog. In these older blog posts, the property that is currently named ItemType was named ModelType, but otherwise the information they contain is valid.)
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)
ASP.NET 4.5 Web Forms Model Binding (ASP.NET site video)
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)
Data Source Web Server Controls
Model Binding and Web Forms (ASP.NET tutorial series)
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.)
ASP.NET 4.5 Web Forms Strong Typed Data Controls (ASP.NET site video)
Getting Started with ASP.NET 4.5 Web Forms - Display Data Items and Details (ASP.NET site)
SQL Server Database Features (A general introduction to SQL Server.)
SQL Server Connection Strings for ASP.NET Web Applications
Using SQL Server Compact for ASP.NET Web Applications
Microsoft SQL Server: Database Product Samples (Sample AdventureWorks databases on the CodePlex site.)
Installing Sample Databases (CodePlex site. In addition to the methods shown here, you can also download one of the sample .mdf files to the App_Data folder of a web project, convert the database to LocalDB, and create a LocalDB connection string. For information about how to do that, see Working with SQL Server Express LocalDB databases.)
See also the following sections on working with SQL Server Express and LocalDB, and choosing between SQL Server and SQL Database.
SQL Server Express 2012 LocalDB
SQL Server Connection Strings for ASP.NET Web Applications
How to: Upgrade to LocalDB (How to migrate an .mdf file from an earlier version of SQL Server Express to LocalDB. You also have to go through this process if you download one of the SQL Server 2012 sample databases.)
Introducing LocalDB, an improved SQL Express (SQL Server Express blog)
LocalDB: Where is My Database? (SQL Server Express blog)
Using LocalDB with Full IIS, Part 1: User Profile (SQL Server Express blog)
SQL Server Connection Strings for ASP.NET Web Applications (If you use the AttachDBFileName connection string setting with SQL Server Express, see especially the User Instance section of this page.)
How to take ownership of your local SQL Server Express 2008 (SQL Server Express blog. A common problem is not being able to work with SQL Server Express databases because you're not an administrator on the SQL Server Express instance. By default, only the person who installed SQL Server Express is an administrator. This blog explains how to make yourself a SQL Server Express administrator if you're an administrator on the computer.)
Can my ASP.NET web application use a SQL Server Express database in production?
SQL Databases (WindowsAzure.com site. Getting started tutorials and how-to guides.)
Windows Azure SQL Database TechNet Wiki Articles Index
Getting Started with SQL Database and Entity Framework (MSDN Data Developer Center)
Transient Fault Handling Application Block A framework that enables you to handle transient network faults and connection errors that result from throttling. Available in a NuGet package: Enterprise Library 5.0 - Transient Fault Handling Application Block.
Windows Azure Training Kit (Microsoft Download Center. Includes hands-on labs for SQL Database.)
Windows Azure SQL Database Community Forum
Moving to Windows Azure SQL Database
Migrating Data-Centric Applications to Windows Azure
Migrating SQL Server Databases to Windows Azure SQL Database
Compare SQL Server with Windows Azure SQL Database (Microsoft TechNet site)
Data Migration to Windows Azure SQL Database: Tools and Techniques (Includes sections that compare SQL Server to SQL Database and provide guidance on when to migrate from SQL Server to SQL Database.)
Windows Azure SQL Database Delivery Guide (Microsoft TechNet site)
SQL Server Feature Limitations (Windows Azure SQL Database)
Windows Azure Table Storage and Windows Azure SQL Database - Compared and Contrasted (For an application that you deploy to Windows Azure, Windows Azure Table storage might be an alternative to Windows Azure SQL Database. This topic helps you decide between these alternatives.)
Guidelines and Limitations (Windows Azure SQL Database)
Windows Azure Data Services (WindowsAzure.com site. See the Table Service feature guide and the Big Data section of the page.
Windows Azure Training Kit (Microsoft Download Center. Includes hands-on labs for Windows Azure Storage tables.)
ASP.NET Data Access Options (Includes an introduction to LINQ.)
LINQ Training Videos (Joe Stagner's blog)
Dynamic Data Project Templates (Guidance on when to use Dynamic Data projects.)
Securing Data Access in ASP.NET
Security Considerations (Entity Framework)
How To: Secure Connection Strings when Using Data Source Controls
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 the previous link.)
See also Optimizing Entity Framework performance.
Web Deployment Content Map for Visual Studio and ASP.NET
Accessing Data through a Web Service (Guidance on when to use Web API versus WCF.)
Getting Started with ASP.NET Web API (ASP.NET site)
WCF Data Services (MSDN Data Developer Center)
ASP.NET Web Forms Tutorials - Data (ASP.NET site. Most of these tutorials are relatively old; make sure you read ASP.NET Data Access Options first so that you don't get too far into a data access method that isn't right for your scenario.)
ASP.NET Web Pages Tutorials - Data (ASP.NET site)
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.)