private Tuple <int, bool> GetCompareMode(DbExpressionKind kind) { switch (kind) { case DbExpressionKind.Equals: return(Tuple.Create(0, true)); case DbExpressionKind.NotEquals: return(Tuple.Create(0, false)); case DbExpressionKind.GreaterThan: return(Tuple.Create(1, true)); case DbExpressionKind.GreaterThanOrEquals: return(Tuple.Create(-1, false)); case DbExpressionKind.LessThan: return(Tuple.Create(-1, true)); case DbExpressionKind.LessThanOrEquals: return(Tuple.Create(1, false)); } throw new InvalidOperationException( "The ExpressionKind cannot be " + kind.ToString()); }
private Expression CreateComparison(Expression left, Expression right, DbExpressionKind kind) { if (left.Type == typeof(string) && right.Type == typeof(string)) { return(CreateStringComparison(left, right, kind)); } switch (kind) { case DbExpressionKind.Equals: return(Expression.Equal(left, right)); case DbExpressionKind.NotEquals: return(Expression.NotEqual(left, right)); case DbExpressionKind.GreaterThan: return(Expression.GreaterThan(left, right)); case DbExpressionKind.GreaterThanOrEquals: return(Expression.GreaterThanOrEqual(left, right)); case DbExpressionKind.LessThan: return(Expression.LessThan(left, right)); case DbExpressionKind.LessThanOrEquals: return(Expression.LessThanOrEqual(left, right)); default: throw new InvalidOperationException( "The ExpressionKind cannot be " + kind.ToString()); } }
private Expression CreateComparison(Expression left, Expression right, DbExpressionKind kind) { if (left.Type == typeof(string) && right.Type == typeof(string)) { return CreateStringComparison(left, right, kind); } switch (kind) { case DbExpressionKind.Equals: return Expression.Equal(left, right); case DbExpressionKind.NotEquals: return Expression.NotEqual(left, right); case DbExpressionKind.GreaterThan: return Expression.GreaterThan(left, right); case DbExpressionKind.GreaterThanOrEquals: return Expression.GreaterThanOrEqual(left, right); case DbExpressionKind.LessThan: return Expression.LessThan(left, right); case DbExpressionKind.LessThanOrEquals: return Expression.LessThanOrEqual(left, right); default: throw new InvalidOperationException( "The ExpressionKind cannot be " + kind.ToString()); } }
private Tuple<int, bool> GetCompareMode(DbExpressionKind kind) { switch (kind) { case DbExpressionKind.Equals: return Tuple.Create(0, true); case DbExpressionKind.NotEquals: return Tuple.Create(0, false); case DbExpressionKind.GreaterThan: return Tuple.Create(1, true); case DbExpressionKind.GreaterThanOrEquals: return Tuple.Create(-1, false); case DbExpressionKind.LessThan: return Tuple.Create(-1, true); case DbExpressionKind.LessThanOrEquals: return Tuple.Create(1, false); } throw new InvalidOperationException( "The ExpressionKind cannot be " + kind.ToString()); }