I have trawled through the odata.org spec for complex types and can't find anywhere where it says that Complex Types cannot refer to Entities, yet the ODataConventionModelBinder.MapComplexType errors if a Complex type refers to a collection of entities (see SRResources.ComplexTypeRefersToEntityType). The associated comment states that complex types cannot refer to entities, implying it is a deliberate design decision.
This is a huge (and unexpected) problem as it prevents actions returning a complex type that (for example) contains a collection of entities and some associated data - a very common scenario. For example, I have a regular synchronization method that returns a set of statistics and any changed entities.
Why is the restriction there at all?
Comments: Complex types do not have identities and therefore cannot exist independently. 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. source: [http://msdn.microsoft.com/en-us/library/ee382831.aspx](http://msdn.microsoft.com/en-us/library/ee382831.aspx) I will let the OData gurus to tell if there is a OData pattern for solving your problem i.e. returning a collection of entities and some associated data.
This is a huge (and unexpected) problem as it prevents actions returning a complex type that (for example) contains a collection of entities and some associated data - a very common scenario. For example, I have a regular synchronization method that returns a set of statistics and any changed entities.
Why is the restriction there at all?
Comments: Complex types do not have identities and therefore cannot exist independently. 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. source: [http://msdn.microsoft.com/en-us/library/ee382831.aspx](http://msdn.microsoft.com/en-us/library/ee382831.aspx) I will let the OData gurus to tell if there is a OData pattern for solving your problem i.e. returning a collection of entities and some associated data.