public virtual ODataExpression VisitFunctionCall(ODataFunctionCallExpression expr) { bool updated = false; ODataExpression[] args = new ODataExpression[expr.Arguments.Length]; for (int i = 0; i < expr.Arguments.Length; i++) { ODataExpression arg = expr.Arguments[i]; ODataExpression newArg = this.Visit(arg); if (newArg != arg) { updated = true; args[i] = newArg; } else { args[i] = arg; } } if (updated) { return new ODataFunctionCallExpression(expr.Name, args); } return expr; }
public Selector(ODataExpression e, Order order) { this.Expression = e; this.Order = order; }
public ODataFunctionCallExpression(string name, ODataExpression[] arguments) { this.Name = name; this.Arguments = arguments; this.ExpressionType = ExpressionType.Call; }
public ODataMemberExpression(ODataExpression instance, string memberName) { if (string.IsNullOrEmpty(memberName)) { throw new ArgumentNullException("memberName"); } this.Instance = instance; this.Member = memberName; this.ExpressionType = ExpressionType.MemberAccess; }
public ODataBinaryExpression(ODataExpression left, ODataExpression right) { this.Left = left; this.Right = right; }
private ODataExpression ParseAny(ODataExpression parent) { return this.ParseAnyAll(parent, true); }
public static ODataExpression Multiply(ODataExpression left, ODataExpression right) { ODataBinaryExpression bex = new ODataBinaryExpression(left, right); bex.ExpressionType = ExpressionType.Multiply; return bex; }
public static ODataExpression Subtract(ODataExpression left, ODataExpression right) { ODataBinaryExpression bex = new ODataBinaryExpression(left, right); bex.ExpressionType = ExpressionType.Subtract; return bex; }
public virtual ODataExpression Visit(ODataExpression expr) { return expr.Accept(this); }
private ODataExpression ParseTypeSegment(ODataExpression parent) { throw new NotSupportedException("Segments unsupported"); }
//TODO private ODataExpression ParseMemberAccess(ODataExpression instance) { if (this.token.Text == "*") { return this.ParseStarMemberAccess(instance); } string identifier = this.GetIdentifier(); if (instance == null && this.parameters.Contains(identifier)) { this.NextToken(); return new ODataParameterExpression(identifier); } this.NextToken(); return new ODataMemberExpression(instance, identifier); }
private ODataExpression ParseStarMemberAccess(ODataExpression instance) { throw new NotSupportedException("star unsupported"); }
private ODataExpression ParseSegment(ODataExpression parent) { string identifier = this.GetIdentifier(); this.NextToken(); if (this.parameters.Contains(identifier) && parent == null) { return new ODataParameterExpression(identifier); } throw new NotSupportedException("Segment not supported"); }
private ODataExpression ParseAnyAll(ODataExpression parent, bool isAny) { //any and all not supported throw new NotSupportedException(); }
public static ODataExpression GreaterThan(ODataExpression left, ODataExpression right) { ODataBinaryExpression bex = new ODataBinaryExpression(left, right); bex.ExpressionType = ExpressionType.GreaterThan; return bex; }
public static ODataExpression Negate(ODataExpression expr) { return new ODataUnaryExpression(expr, ExpressionType.Negate); }
public static ODataExpression LessThanOrEqual(ODataExpression left, ODataExpression right) { ODataBinaryExpression bex = new ODataBinaryExpression(left, right); bex.ExpressionType = ExpressionType.LessThanOrEqual; return bex; }
public static ODataExpression Not(ODataExpression expr) { return new ODataUnaryExpression(expr, ExpressionType.Not); }
public static ODataExpression AndAlso(ODataExpression left, ODataExpression right) { ODataBinaryExpression bex = new ODataBinaryExpression(left, right); bex.ExpressionType = ExpressionType.AndAlso; return bex; }
public ODataUnaryExpression(ODataExpression expr, ExpressionType type) { this.Operand = expr; this.ExpressionType = type; }
public static ODataExpression Divide(ODataExpression left, ODataExpression right) { ODataBinaryExpression bex = new ODataBinaryExpression(left, right); bex.ExpressionType = ExpressionType.Divide; return bex; }
private ODataExpression ParseAll(ODataExpression parent) { return this.ParseAnyAll(parent, false); }