This is because inside your expression you are accessing the field. An exception indicates that you are accessing a field.
The expression is not evaluated when the request is created. It is executed only after its execution. At this point, he will need to allow the field. The workaround is to get the expression first into a local variable:
private static string GetSomething(IQueryable<EnumTest> things)
{
var expression = Program.ConvertToString;
var ret = things
.AsExpandable()
.Select(c => expression.Invoke(c.SomeEnum))
.First();
return ret;
}
, EntityFramework, , SQL-. , , SQL ( ?).
( ), SQL.