Entityframework 4.0 .CreateQuery<T> and OrderBy exception
- by Sammy
Hi Guys,
I thought this was fixed in 4.0
I have this method
public IQueryable<T> All(Expression<Func<T,object>> sort)
{
return EntityContext.CreateQuery<T>(EntityName).AsQueryable<T>().OrderBy(sort);
}
this throws the following exception
Unable to cast the type 'System.Int32' to type 'System.Object'. LINQ to Entities only supports casting Entity Data Model primitive types.
Source is System.Data.Entity
any idea how to fix this or if theres any workaround