I have a gallery entity framework class,and I'm attempting to use the Dynamic Linq Library posted on ScottGu's blog to query the entity set. The failing line of code reads:
return context.Galleries.OrderBy(sidx + " " + sord).Skip(page * rows).Take(rows).ToList();
sidx=="Name", and sord=="desc".
The Gallery object does have a property called "Name". However, when executed, i get the following exception:
'Title' 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., near simple identifier, line 6, column 1.
Does anyone know what this means?
"it" alias was the problem so the following code should works:
prefix your filter field name Title as it.Title
I found the answer here .. http://challenge-me.ws/?tag=/Exceptions
use: AsQueryable<>
return context.Galleries.AsQueryable().OrderBy(sidx + " " + sord).Skip(page * rows).Take(rows).ToList();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With