I'm using jqGrid and I have a problem getting Dynamic Linq to work. I used NuGet to install Dynamic and added "using System.Linq.Dynamic;".
Using VS 2010 Pro, MVC 3.0
var s = context.testdata; var c = s.Count();
c shows 5136 items.
But I cannot get the dynamic approach to work:
var s = context.testdata.OrderBy("id asc");
I get this error message:
'id' could not be resolved in the current scope or context. Make sure that all referenced variables are in scope, that required schemas are loaded, and that namespaces are referenced correctly.
This however does work:
var s = (from ss in context.testdata orderby ss.id select ss).ToList(); var c = s.Count();
Again I get all 5136 items.
I've got the code from here:
Any idea what I am doing wrong?
OK, found the solution here:
Strange Exception thrown using Dynamic Linq Entity Framework Query
var s = context.testdata.OrderBy("it.id asc");