I use WCF DataSerice and EF4.1 code-first (C#).
I have 2 entities:
1. Person
2. User inherited from Person class
I want to get only User objects from DbSet Persons. How can I do that?
Then I query dataervice like that:
service.CreateQuery<User>("DbPersons").OfType<User>().Execute();
I get an exception that OfType method is not supported by dataservice context.
Error translating Linq expression to URI: The method ‘OfType’ is not supported.
Ok, solved by adding service operation method.
See solution here http://msdn.microsoft.com/en-us/library/cc668788.aspx
here is my code:
and in your client application send request as usual: