Partilhar via


How to: Create and Edit Association Mappings (Entity Data Model Tools)

Associations define relationships between entity types in the conceptual model. Association details are specified in the corresponding association mapping. You can create and edit association mappings in the Mapping Details window of the ADO.NET Entity Data Model Designer (Entity Designer).

NoteNote

If a referential constraint exists on an association, you cannot map the association. If an entity key-to-entity key referential constraint exists on an association, mappings will be ignored.

For information about how to use the Entity Designer to create associations between entity types, see How to: Create and Modify Associations (Entity Data Model Tools).

To create an association mapping

  1. Right-click an association in the design surface and select Table Mapping.

    This displays the association mapping in the Mapping Details window.

  2. Click Add a Table or View.

    A drop-down list appears that includes all the tables in the storage model.

  3. Select the table to which the association will map.

    The Mapping Details window displays both ends of the association and the key properties for the entity type at each End.

  4. For each key property, click the Column field, and select the column to which the property will map.

To edit an association mapping

  1. Select an association in the design surface.

    This displays the association mapping in the Mapping Details window.

  2. Click Maps to <Table Name>.

    A drop-down list appears that includes all the tables in the storage model.

  3. Select the table to which the association will map.

    The Mapping Details window displays both ends of the association and the key properties for the entity type at each End.

  4. For each key property, click the Column field, and select the column to which the property will map.

See Also

Concepts

Implementing Advanced Entity Framework Features

Other Resources

Entity Data Model Tools Tasks
Entity Data Model Tools Scenarios