This is a migrated thread and some comments may be shown as answers.

WCF ODATA: OrderBy on a navigation property does not work

2 Answers 725 Views
Web Services
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Samuel
Top achievements
Rank 1
Samuel asked on 26 Sep 2013, 09:47 AM
Consider the following pseudo-model:

Document { 
 Id : int
 Filename : String
 Client :  Client
}

Client {
 Id: int
 Name: String
 City: String
}

The following ODATA query fails:

http://localhost:1880/EntitiesModel1Service.svc/DocumentSources?$format=json&$expand=Client&$inlinecount=allpages&$orderby=Client.City%20asc

The error is: 

  • "The child type 'Client.City' in a cast was not an entity type. Casts can only be performed on entity types."

I've tried with various types of entities and sorting works fine on simple properties but as soon as I sort by navigation properties, it fails.

Could that be a bug in the Queryable implementation ? Or am I missing something ? 

2 Answers, 1 is accepted

Sort by
0
Samuel
Top achievements
Rank 1
answered on 26 Sep 2013, 09:50 AM
0
n/a
Top achievements
Rank 1
answered on 21 Apr 2016, 11:03 AM

Hello Samuel,

 

Could you please tell me odata version are you using??

 

Thank you.

Tags
Web Services
Asked by
Samuel
Top achievements
Rank 1
Answers by
Samuel
Top achievements
Rank 1
n/a
Top achievements
Rank 1
Share this question
or