Language

ASP.NET Data Access - Recommended Resources

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.

If you know a great blog post, stackoverflow thread, or any other link that would be useful, send us an email with the link.

Last updated 4/3/2014

The topic contains the following sections:

 

Getting Started with Data Access in ASP.NET

  • Data Storage Options (Building Real-World Cloud Apps with Windows Azure). Chapter of an e-book about developing for the cloud. Introduces NoSQL databases as an alternative that many developers familiar with relational databases tend to overlook. Presents guidelines on what to think about when choosing relational or NoSQL, or choosing a particular platform.
  • ASP.NET Data Access Options (MSDN). An introduction to data access options for relational databases for ASP.NET and guidance on how to choose platforms and access methods that are appropriate for your scenario.
  • Relational database. Wikipedia). 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.

Using the Entity Framework

Using Entity Framework Code First


The following tutorials offer downloadable sample applications:

  • Getting Started with EF 6 using MVC 5. Covers a wide range of Entity Framework Code First scenarios, including Migrations and EF 6 features such as connection resiliency, command interception, and async. This is an updated version of the EF 5 / MVC 4 series. The earlier series includes a tutorial on the repository and unit-of-work patterns that is not included in the new series.
  • Introduction to ASP.NET MVC 5. Covers a narrower range of Entity Framework Code First scenarios but does a more comprehensive job of introducing MVC features.
  • Model Binding and Web Forms. Uses Code First in a Web Forms application.
  • Getting Started with ASP.NET 4.5 Web Forms. An introduction to Web Forms with some coverage of Code First.  Uses Model Binding.
  • MVC Music Store. Uses Code First in an e-commerce MVC 3 application that also implements membership and authorization. The MVC version and ASP.NET membership (authentication and authorization) system used here are outdated; for more up-to-date information on ASP.NET membership, see http://asp.net/identity.

Other resources:

See also Books about the Entity Framework and Additional Entity Framework Resources later in this topic.

Using Entity Framework Code First Migrations


Most of the Code First tutorials listed above cover migrations. See also the following resources.

Using Entity Framework Database First or Model First (the EF Designer)

  • Getting Started with Entity Framework 6 Database First using MVC 5. Run a script in Server Explorer to create a database, and then use the Entity Framework designer to create the data model. Shows how to create simple CRUD web pages, and for other data handling functions you can follow one of the Code First tutorials since all EF workflows use the same DbContext API.

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.

Handling 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

Both of these books are up-to-date with current recommended techniques. They provide a 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. See also the list of books recommended by the Entity Framework team at Data Developer Center - Books on the MSDN site.

Other 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

See also the following sections on working with SQL Server Express and LocalDB, and choosing between SQL Server and SQL Database.

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

See also Optimizing Entity Framework performance earlier in this topic.

Deploying a Database

Accessing Data through a Web Service

Additional Resources