Exemplo n.º 1
0
        protected override Expression VisitMethodCallExpression(MethodCallExpression methodCallExpression)
        {
            var newExpression
                = (MethodCallExpression)base.VisitMethodCallExpression(methodCallExpression);

            if (newExpression != methodCallExpression &&
                newExpression.Arguments.Any() &&
                newExpression.Arguments[0].Type == typeof(IValueReader))
            {
                return
                    (_queryModelVisitor
                     .BindMethodCallToValueReader(methodCallExpression, newExpression.Arguments[0])
                     ?? newExpression);
            }

            return(_queryModelVisitor
                   .BindMethodCallExpression(
                       methodCallExpression,
                       (property, _) => Expression.Call(
                           _getValueMethodInfo.MakeGenericMethod(newExpression.Method.GetGenericArguments()[0]),
                           EntityQueryModelVisitor.QueryContextParameter,
                           newExpression.Arguments[0],
                           Expression.Constant(property)))
                   ?? newExpression);
        }