my code :
public List<Book> GetBook()
{
var q = this.Entities.Book.Where("IdBook>1").ToList();
return (q);
}
error :
‘IdBook’ 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.
What is the correct code?
Linq doesn’t allow using strings as expression unless you are using Dynamic Linq library (in such case the error says that
IdBookdoesn’t exists). If you are not using Dynamic Linq library and you still have Where extension method accepting string it is a method expecting valid Entity SQL expression so try: