I'm trying to do OrderBy, but receiving the following error:
The call is ambiguous between the following methods or properties: 'System.Linq.Dynamic.DynamicQueryable.OrderBy(System.Linq.IQueryable, string, params object[])' and 'System.Linq.Dynamic.DynamicQueryable.OrderBy(System.Linq.IQueryable, string, params object[])'
int start = Convert.ToInt32(Request["start"]);
int length = Convert.ToInt32(Request["length"]);
string searchValue = Request["search[value]"];
string sortColumnName = Request["columns[" + Request["order[0][column]"] + "][name]"];
string sortDirection = Request["order[0][dir]"];
List<Account> tAccounts = new List<Account>();
using (Entities dbcontext = new Entities())
{
tAccounts = dbcontext.Accounts
.AsQueryable()
.OrderBy(sortColumnName + " " + sortDirection)
.Skip(start)
.Take(length)
.ToList();
I have changed the code to the following as System.Linq.Dynamic was causing ambiguous between the different methods, but now have a new issue IQueryable does not contain a definition for 'ToList' any pointers much appreciated.
var tAcc = from x in dbcontext.Accounts
select x.AsEnumerableOfOne()
.OrderBy(sortColumnName + " " + sortDirection)
.Skip(start)
.Take(length)
.ToList();
tAccounts = tAcc.ToList<Account>();