Partilhar via


How to: Map Complex Type Properties to Table Columns (Entity Data Model Tools)

This topic describes how to map a complex type property to table columns by using the ADO.NET Entity Data Model Designer (Entity Designer). The Mapping Details window enables you map scalar and complex type properties of entities to one or more tables, define conditions for the mappings, and specify the column to property mappings. The procedures in this topic apply to both scalar and complex type properties of entities.

NoteNote

This topic focuses on how to map a complex type property to a single database table. However, complex type properties can be mapped to multiple database tables. The process is similar to mapping scalar properties to multiple tables. For an example of how to map scalar properties to multiple tables, see Walkthrough: Mapping an Entity to Multiple Tables (Entity Data Model Tools).

The following table describes the fields in the Mapping Details window when an entity type is selected on the design surface.

Name Description

Column

Contains an alphabetized list of all columns in the table.

Operator

Shows the mapping or condition operator.

Value/Property

Displays the entity property that is mapped to the column. Complex type properties will appear as ComplexTypePropertyName.PropertyName.

If the field is blank, the column is currently not mapped to a scalar property.

When you click the field, it becomes a drop-down list that displays all the scalar properties.

To add a mapping

  1. Right-click an entity type on the design surface or in the Model Browser and select Table Mappings.

    The table mappings are displayed in the Mapping Details window.

  2. Expand the Maps to <Table Name> node.

    A Column Mappings node appears.

  3. Expand the Column Mappings node.

    A list of all the columns in the table appears. The default properties (if any) to which the columns map are listed under the Value/Property heading.

  4. Select the column you want to map, and then right-click the corresponding Value/Property field.

    A drop-down list of all the scalar properties is displayed.

  5. Select the appropriate property.

  6. Repeat steps 6 and 7 for each table column.

To delete a column mapping

  1. Select the column that you want to map, and then click the Value/Property field.

    The field becomes a drop-down list.

  2. Select Delete.

See Also

Tasks

How to: Create and Modify Complex Types (Entity Data Model Tools)
How to: Add a Complex Type Property to an Entity (Entity Data Model Tools)
How to: Map a Function Import to a Complex Type (Entity Data Model Tools)
How to: Refactor Existing Properties into a Complex Type Property (Entity Data Model Tools)
How to: Add or Delete Conditions (Entity Data Model Tools)
How to: Map Entities to Database Tables (Entity Data Model Tools)

Other Resources

Entity Data Model Tools Tasks
Entity Data Model Tools Scenarios