Udostępnij za pośrednictwem


ASP.NET Data Access Content Map

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 Data Access Options for ASP.NET Web Applications

Choosing an Entity Framework development workflow (Code First, Database First, or Model First)

Choosing Data Access Options for ASP.NET Web Applications

Using Entity Framework Code First

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.)

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 the Using Entity Framework Code First Migrations scenario.)

Data Developer Center - Entity Framework

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

Using Entity Framework Code First Migrations

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 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.)

Using Entity Framework Database First or 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 relatively old but can be used as an introduction to the EntityDataSource control. Before starting this tutorial, review Web Forms data binding methods in Choosing Data Access Options for ASP.NET Web Applications to determine if a data source control is the right choice for your scenario.)

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, 1 on EF performance, and one on what's new in EF 4.0. The what's new tutorial includes a brief introduction to Model First. Most of the tutorials in this series use techniques that are no longer recommended for new development. The DbContext API is now recommended instead of the ObjectContext API. If you want to write a data access layer and you are targeting ASP.NET 4.5, Web Forms model binding is now recommended instead of the ObjectDataSource control.

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

Data Developer Center - Entity Framework

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.)

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.

Data Developer Center - Loading Related Entities

Improving Entity Framework performance

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.)

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

Performance Considerations for Entity Framework 5

Performance Considerations (Entity Framework)

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.)

Data Developer Center – Optimistic Concurrency Patterns

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.

Data Developer Center - Books

Other Entity Framework resources

Entity Framework (ADO.NET) team blog

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

Using Web Forms Model Binding

Choosing Data Access Options for ASP.NET Web 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. 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)

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 Data Access Options for ASP.NET Web 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 Data Access Options for ASP.NET Web 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.)

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)

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 Data Access Options for ASP.NET Web Applications (Includes sections on how to choose a SQL Server edition for web development.)

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 the Working with SQL Server Express LocalDB databases scenario.)

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

Working with SQL Server Express LocalDB databases

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)

Working with SQL Server Express databases

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.)

Choosing between SQL Server and 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.)

Windows Azure SQL Database

Using LINQ queries in ASP.NET applications

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

LINQ Training Videos (Joe Stagner's blog)

Using Dynamic Data scaffolding

Choosing Data Access Options for ASP.NET Web 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 the previous link.)

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 Data Access Options for ASP.NET Web 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 Overview - Data

ASP.NET MVC 4 (See the Working with data and the Entity Framework 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.)