示例#1
0
        private static IExpression CreateContainsExpression(IExpression lhs, IExpression rhs)
        {
            // The "contains" operator is a bit fuzzy in that it sometimes performs an equal operation, and at other times it performs a range check.
            // It exists to allow users to construct complex filters using a simple language.
            // Example: "today contains $timestamp" is understandable to most people even though it actually evaluates to
            //          "$timestamp.year == now.year and $timestamp.month == now.month and $timestamp.day == now.day"

            if (lhs is IExpression <IInterval <DateTime?> > lhsDateTimeInterval &&
                rhs is IExpression <DateTime?> rhsDateTime)
            {
                return(ContainsTimestampExpression.Create(lhsDateTimeInterval, rhsDateTime));
            }

            if (lhs is IExpression <string> lhsString &&
                rhs is IExpression <string> rhsString)
            {
                return(ContainsStringExpression.Create(lhsString, rhsString));
            }

            throw new NotImplementedException();
        }
示例#2
0
 private bool Equals(ContainsTimestampExpression other)
 {
     return(_lhs.Equals(other._lhs) && _rhs.Equals(other._rhs));
 }