Hi,
I'm seeing some strange behaviour with the OData $orderby and properties of complex type. Suppose I have a class of the form:
Name Title B + Name + SubTitle + C + Name + SubSubTitle
i.e. I have a containment hierarchy with some properties (Name) shared by several levels of the hierarchy, and some (Title, SubTitle, SubSubTitle) specific to a particular level.
I would expect to be able to run OData queries to sort by any of these properties:
- $orderby=Name
- $orderby=B/Name
- $orderby=B/C/Name
- $orderby=B/SubTitle
- $orderby=B/C/SubSubTitle
and am relatively sure I was able to do this using the old WCF Web API. However, I'm now finding two unexpected consequences:
Requests 1, 2 and 3 all give the same recordset - it's as if the Name property on the parent object is being used as the key to sort by even if the specified $orderby field is on a subobject.
Request 5 throws an exception of the form:
Instance property 'SubSubTitle' is not defined for type 'A'.
Is this a known limitation of the current OData support? If so, is there a workaround that doesn't involve polluting the object model by creating dummy properties on the parent object that defer to the children?
Let me know if further clarification is required...
Cheers,
Jack.