using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; using SqlLinq.SyntaxTree.Literals; namespace SqlLinq.SyntaxTree.Predicates.Comparison { [SyntaxNode(RuleConstants.RULE_PREDEXP_IN)] public class InNode : PredicateNode { public InNode() : base(typeof(string), typeof(bool)) { } protected override Expression CreateOperatorExpression(ParameterExpression param, Expression left) { Expression expression = null; foreach (LiteralNode literal in GetLiteralList()) { Expression equal = Expression.Equal(left, Expression.Constant(literal.ValueObject, literal.ValueType)); if (expression == null) expression = equal; else expression = Expression.OrElse(expression, equal); } return expression; } private IEnumerable<LiteralNode> GetLiteralList() { return FindDescendants<LiteralNode>(); } } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
10 PRINT "Don is cool" 20 GOTO 10