I would like to be able to register my own expression visitor, that can be used by EF in queries processing. order to process queries.
It should solve Linq Funcletization issues (like https://entityframework.codeplex.com/workitem/1413) in a simple way, by writing my own expression visitor, for example: proof of concept code, not efficient, etc.):
It should solve Linq Funcletization issues (like https://entityframework.codeplex.com/workitem/1413) in a simple way, by writing my own expression visitor, for example: proof of concept code, not efficient, etc.):
public class AddDaysInlineVisitor : ExpressionVisitor
{
protected override Expression VisitMethodCall(MethodCallExpression node)
{
if (node.Method.Name == "AddDays")
{
var lambda = Expression.Lambda(node).Compile().DynamicInvoke();
return Expression.Constant(lambda, node.Type);
}
return base.VisitMethodCall(node);
}
}
Also, it should be used to create calculated fields, or something like https://entityframework.codeplex.com/discussions/394377