The Microsoft ADO.NET Entity Framework is an Object/Relational Mapping (ORM) framework that enables developers to work with relational data as domain-specific objects, eliminating the need for most of the data access plumbing code that developers usually need to write. Using the Entity Framework, developers issue queries using LINQ, then retrieve and manipulate data as strongly typed objects. The Entity Framework’s ORM implementation provides services like change tracking, identity resolution, lazy Continue reading
Using Dynamic Data Functionality to Format and Validate Data
In the previous tutorial you implemented stored procedures. This tutorial will show you how Dynamic Data functionality can provide the following benefits:
- Fields are automatically formatted for display based on their data type.
- Fields are automatically validated based on their data type.
- You can add metadata to the data model to customize formatting and validation behavior. When you do this, you can add the formatting and validation rules in just one place, and they’re automatically applied everywhere you access the fields using Dynamic Data controls.
To see how this works, you’ll change the controls you use to display and edit fields in the existing Students.aspx page, and you’ll add formatting and validation metadata to the name and date fields of the
Student entity type. Continue reading
Using Stored Procedures
The Entity Framework lets you specify that it should use stored procedures for database access. For any entity type, you can specify a stored procedure to use for creating, updating, or deleting entities of that type. Then in the data model you can add references to stored procedures that you can use to perform tasks such as retrieving sets of entities. Continue reading
Implementing Table-per-Hierarchy Inheritance
In the previous tutorial you worked with related data by adding and deleting relationships and by adding a new entity that had a relationship to an existing entity. This tutorial will show you how to implement inheritance in the data model.
In object-oriented programming, you can use inheritance to make it easier to work with related classes. For example, you could create
Student classes that derive from a
Person base class. You can create the same kinds of inheritance structures among entities in the Entity Framework. Continue reading
Working with Related Data, Continued
In the previous tutorial you began to use the
EntityDataSource control to work with related data. You displayed multiple levels of hierarchy and edited data in navigation properties. In this tutorial you’ll continue to work with related data by adding and deleting relationships and by adding a new entity that has a relationship to an existing entity.
You’ll create a page that adds courses that are assigned to departments. The departments already exist, and when you create a new course, at the same time you’ll establish a relationship between it and an existing department.