Export (0) Print
Expand All

How to: Add a Complex Type Property to an Entity

[This page is specific to the latest version of the Entity Framework. The latest version is available as the 'Entity Framework' NuGet package. For more information, see Entity Framework Releases and Versioning.]

The procedures in this topic describe how to use the Entity Designer to add a complex type property to an entity. For information about using complex types, see Complex Type Objects (Entity Framework).

The following procedures assume that you have an .edmx file open in the Entity Designer.

Add an Existing Complex Type to an Entity

To add an existing complex type to an entity

  1. Right-click an entity, point to Add , and select Complex Property .

    A complex type property with a default name is added to the entity. A default type (chosen from the existing complex types) is assigned to the property.

  2. Assign the desired type to the property in the Properties window.

    noteNote:
    After adding a complex type property to an entity, you must map its properties to table columns. For more information, see How to: Map Complex Type Properties to Table Columns.

Refactor Existing Properties into a Complex Type

To refactor existing properties into a complex type

  • On the Entity Designer surface, select one or more properties (excluding navigation properties) of an entity, then right-click and select Refactor into New Complex Type .

    A new complex type with the selected properties is added to the Model Browser. The complex type is given a default name. For information about renaming a complex type, see How to: Create and Modify Complex Types.

    A complex property of the newly created type replaces the selected properties. All property mappings are preserved.

See Also




Build Date:

2013-06-19
Show:
© 2014 Microsoft