Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
A complex type is a template for defining rich, structured properties on entity types or on other complex types. Each template contains the following:
A unique name. (Required)
Note
The name of a complex type cannot be the same as an entity type name within the same namespace.
Data in the form of one or more properties. (Optional.)
Note
A property of a complex type can be another complex type.
A complex type is similar to an entity type in that a complex type can carry a data payload in the form of primitive type properties or other complex types. However, there are some key differences between complex types and entity types:
Complex types do not have identities and therefore cannot exist independently. Complex types can only exist as properties on entity types or other complex types.
Complex types cannot participate in associations. Neither end of an association can be a complex type, and therefore navigation properties cannot be defined on complex types.
The ADO.NET Entity Framework uses a domain-specific language (DSL) called conceptual schema definition language (CSDL) to define conceptual models. The following CSDL defines a complex type, Address, with the primitive type properties StreetAddress
, City
, StateOrProvince
, Country
, and PostalCode
.
<ComplexType Name="Address" >
<Property Type="String" Name="StreetAddress" Nullable="false" />
<Property Type="String" Name="City" Nullable="false" />
<Property Type="String" Name="StateOrProvince" Nullable="false" />
<Property Type="String" Name="Country" Nullable="false" />
<Property Type="String" Name="PostalCode" Nullable="false" />
</ComplexType>
To define the complex type Address
(above) as a property on an entity type, you must declare the property type in the entity type definition. The following CSDL declares the Address
property as a complex type on an entity type (Publisher):
<EntityType Name="Publisher">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Type="Int32" Name="Id" Nullable="false" />
<Property Type="String" Name="Name" Nullable="false" />
<Property Type="BooksModel.Address" Name="Address" Nullable="false" />
<NavigationProperty Name="Books" Relationship="BooksModel.PublishedBy"
FromRole="Publisher" ToRole="Book" />
</EntityType>
Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Reduce complexity in your data model with Dataverse table relationships - Training
Learn how to use Microsoft Dataverse relationships in canvas apps from Microsoft Power Apps.