Example #1
0
        protected override Expression VisitMember(MemberExpression expression)
        {
            // Field hierarchy is flattened (Person.Address.Street is just Street), append as is, do not call Visit.

            // Property call (string.Length, DateTime.Month, etc).
            if (MethodVisitor.VisitPropertyCall(expression, this))
            {
                return(expression);
            }

            // Special case: grouping
            if (VisitGroupByMember(expression.Expression))
            {
                return(expression);
            }

            var queryable = ExpressionWalker.GetCacheQueryable(expression, false);

            if (queryable != null)
            {
                // Find where the projection comes from.
                expression = ExpressionWalker.GetProjectedMember(expression.Expression, expression.Member) ??
                             expression;

                var fieldName = GetEscapedFieldName(expression, queryable);

                ResultBuilder.AppendFormat("{0}.{1}", Aliases.GetTableAlias(expression), fieldName);
            }
            else
            {
                AppendParameter(ExpressionWalker.EvaluateExpression <object>(expression));
            }

            return(expression);
        }
Example #2
0
        protected override Expression VisitConstant(ConstantExpression expression)
        {
            if (MethodVisitor.VisitConstantCall(expression, this))
            {
                return(expression);
            }

            AppendParameter(expression.Value);

            return(expression);
        }
Example #3
0
        protected override Expression VisitMethodCall(MethodCallExpression expression)
        {
            MethodVisitor.VisitMethodCall(expression, this);

            return(expression);
        }