views:

558

answers:

1

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?

A: 

I found a fix, but it doesnt explain the original issue. The query was in a library, and being referenced from the asp.net mvc application. It compiled fine, but bombed at runtime. The fix was putting the dynamiclinq class in the mvc app itself, returning a plain IQueryable form the library, and doing the filtering in the controller itself. The exact same code worked there. Somehow the separation in the library caused the issue.

midas06