I got this error message while querying the top 50 row in a table. My project uses Entity Framework 4 CTP 5 POCO:
Unable to cast object of type 'System.Data.Entity.Infrastructure.DbQuery' to type 'System.Linq.IQueryable`1[Lib.Model.Post]'
My Models was based on this answer: Entity Framework 4 CTP 4 / CTP 5 Generic Repository Pattern and Unit Testable
Any idea on how to fix this error?
Thanks.
After changing the DataService context and override the ObjectContext, the service is now working. Here’s what I’ve changed in case anyone also run into the same problem:
to