Breeze supports the concept that any data property of an Entity can be an instance of a complex type. A complexType property is a data property that represents a defined collection of other data Properties and possibly nested complex type properties. An example might be a location property on a Customer class, where the location consists of an address, city, state, and zip code. In this case, the location property on the Customer type is termed a complex property, and the data type of this property would be a complex type of type location. The path to a city in this case would be
aCustomer.Location.City.
Complex types in Breeze are much like entity type’s but with some key differences.
Every instance of a complex type object has a ComplexAspect property automatically added by Breeze:
Queries can return ComplexTypes and ComplexType properties can be queried, i.e.
EntityQuery.From<Customer>().Where(c => c.Location.City.StartsWith("A");
Entities containing complex types may be saved.
IEntity.PropertyChanged and EntityManager.EntityChanged events return “property paths” whenever a property of an embedded complex type is modified. i.e. Location.City.
Analagous to the EntityTypes property and the GetEntityType method, the MetadataStore also has a ComplexTypes property and a GetComplexType method.
Both EntityType and ComplexType classes extend the StructuralType abstract class. The StructuralType class implements an IsEntityType property that will return ‘true’ for EntityTypes and ‘false’ for ComplexTypes.
Validating an entity validates all of the properties, including complex type properties of an entity
Validating a complex type property involves validating all of its properties. Property level validation errors involving complex type properties include the “property path” to the errant property.