Пример #1
0
        public void Issue95Test()
        {
            using (var db = new TestDataConnection())
            {
                var q   = db.GetTable <Issue95Entity>().Where(_ => _.EnumValue == TinyIntEnum.Value1);
                var ctx = q.GetMyContext();
                Assert.IsNull(QueryVisitor.Find(ctx.SelectQuery.Where, _ => _.ElementType == QueryElementType.SqlExpression), db.GetSqlText(ctx.SelectQuery));

                q   = db.GetTable <Issue95Entity>().Where(_ => TinyIntEnum.Value1 == _.EnumValue);
                ctx = q.GetMyContext();
                Assert.IsNull(QueryVisitor.Find(ctx.SelectQuery.Where, _ => _.ElementType == QueryElementType.SqlExpression), db.GetSqlText(ctx.SelectQuery));

                var p = TinyIntEnum.Value2;

                q   = db.GetTable <Issue95Entity>().Where(_ => _.EnumValue == p);
                ctx = q.GetMyContext();
                Assert.IsNull(QueryVisitor.Find(ctx.SelectQuery.Where, _ => _.ElementType == QueryElementType.SqlExpression), db.GetSqlText(ctx.SelectQuery));

                q   = db.GetTable <Issue95Entity>().Where(_ => p == _.EnumValue);
                ctx = q.GetMyContext();
                Assert.IsNull(QueryVisitor.Find(ctx.SelectQuery.Where, _ => _.ElementType == QueryElementType.SqlExpression), db.GetSqlText(ctx.SelectQuery));
            }
        }