I want to do:
context.Entities.Select(x => new {
x.Age,
x.Name,
Custom = Function(x));
bool Function(Entitiy e)
{
return e.Cust1 || e.Cust2;
}
Without changing the IQueryable to IEnumerable (ToList/ToArray...). As you can see the properties I want to run the function for are all in Entity, so I was wandering if there was actually a way to do this. for example with expression or some special syntax.
maybe something similar to this:
context.Entities.Select(x => new {
x.Age,
x.Name,
Custom = exp.Compile()(x));
Expression<Func<Entity, bool>> exp = y => y.Cust1 || y.Cust2;
but this way of using compile Func and not Expression loads to memory.