共用方式為


Design and Implementation (EDM)

Application developers who use the Entity Data Model (EDM) define data in a conceptual design schema that exists as an independent middle tier between the programming object model and storage structures. This is useful because entities and associations in the conceptual schema can be designed to reflect application scenarios instead of database tables.

The EDM framework supplies basic entity and association types that are used in the conceptual schema; developers extend the basic types as needed for applications. Both the basic EDM types and custom extensions are defined in XML schemas.

Design Formalized in Schemas

EDM types are designed in schemas to preserve the logical integrity of data and the constraints of business and technical applications. If you use a design that is purely conceptual, it is possible to explore all the permutations of structure when it is still easy to make changes. When the abstract specification is complete, entities defined in schemas become the design templates for programmable objects.

Object models reflect the languages in which they are implemented. The discovery process in the design of an application that uses the EDM is unimpeded by code syntax. The structure of data in an EDM application is specified by using a conceptual schema and the design is based on application scenarios. The conceptual schema is used in every stage of development.

Designing a data model in XML schemas also provides some independence from storage technology. Applications using the EDM can be adapted to any storage platform. Design based on the EDM solves many of the problems that have to be dealt with through database normalization when the process is based on a relational database.

Object Services Implementation from Schemas

In the EDM, entities and relationships are formally defined in XML syntax in a design schema. This schema is mapped to another schema that contains metadata describing the storage model. Common language runtime (CLR) data types for use in application code are built from the design schema. For more information about schemas, see Schemas (EDM).

The design of a data model according to the EDM specification can begin with the conceptual schema or build on legacy systems by generating the conceptual schema from an existing database. Whether the conceptual schema is created directly in XML syntax or from a database, the schema can be mapped to metadata representing the storage structures used by the application. For more information about mapping, see Schemas and Mapping Specification (Entity Framework).

When the implementation is complete, instances of entity types, such as the LOB types customer, order, employee, and so on, can be declared in application code as programmable objects. The types defined in the conceptual schema are prototypes for data that is used by application code. The mapping specification connects them seamlessly to storage. Data can be queried or persisted without writing SQL queries or update statements.

For more information about how to define entities and relationships in the EDM, see Entity Data Model Types.

See Also

Concepts

Entities and Relationships (EDM)
Implementing Entities (EDM)
Implementing Associations (EDM)

Other Resources

EDM Specifications
Sample Applications (Entity Framework)