Exemple #1
0
        public override NLinq.Expressions.Expression Visit(NLinq.Expressions.MemberExpression expression)
        {
            if (inWhere)
            {
                Visit(expression.Previous);
                Visit(expression.Statement);

            }
            else if (inFrom)
            {
                Visit(expression.Previous);
                if (currentProperty.Target != null)
                    throw new NotSupportedException();
                currentProperty.Target = new PropertyExpression();
                currentProperty = currentProperty.Target;
                Visit(expression.Statement);
            }
            else
            {
                if (uri.Filter != null || uri.Expand != null || uri.InLineCount != null || uri.Top != null || uri.Skip != null || uri.Select != null)
                    return expression;

                currentProperty.Target = new PropertyExpression();
                currentProperty = currentProperty.Target;
                Visit(expression.Statement);
            }

            return expression;
        }
Exemple #2
0
 public override NLinq.Expressions.QueryBodyClause Visit(NLinq.Expressions.FromClause expression)
 {
     if (!inQueryBodyClauses)
     {
         uri = new RootContainerExpression() { Type = expression.Type };
         identifiers.Add(expression.Identifier.Text, uri);
     }
     else
     {
         inFrom = true;
         currentProperty = new PropertyExpression();
         identifiers.Add(expression.Identifier.Text, currentProperty);
         Visit(expression.Expression);
         inFrom = false;
     }
     return expression;
 }
Exemple #3
0
 protected override NLinq.Expressions.Identifier VisitIdentifier(NLinq.Expressions.Identifier identifier)
 {
     if (inWhere)
     {
         PropertyExpression currentProperty;
         if (identifiers.TryGetValue(identifier.Text, out currentProperty))
             this.currentProperty = currentProperty;
         else
         {
             constraintBuilder.Append(identifier.Text);
         }
     }
     else
     {
         if (string.IsNullOrEmpty(currentProperty.Name))
             currentProperty.Name = identifier.Text;
         else
             throw new NotSupportedException();
     }
     return identifier;
 }