Exemple #1
0
        public void LogicalExpressionTest()
        {
            int i = new Random().Next();
            //TestExpression<UserProfile>(x => x.Id == 1);
            var logicalExp0 = SqlExpression.Expression <UserProfile>(x => x.Id == i);
            var logicalExp1 = SqlExpression.Expression <UserProfile>(x => x.Id == i && (x.Name == (object)new object[] { "test0", "test1", i } || x.Sex == 1));
            var logicalExp2 = SqlExpression.Expression <UserProfile>(x => x.Id == i && (x.Name == (object)new List <object> {
                "test0", "test1", i
            } || x.Sex == 1));
            var logicalExp3 = SqlExpression.Expression <UserProfile>(x => x.Id > 10 || x.Id < 2);
            var logicalExp4 = SqlExpression.Expression <UserProfile>(x => x.Id >= 10 || x.Id <= 2);

            var array = new object[] { "test0", "test1", i };
            var list  = new List <object> {
                "test0", "test1", i
            };
            var logicalExp5 = SqlExpression.Expression <UserProfile>(x => array.Contains(x.Name));
            var logicalExp6 = SqlExpression.Expression <UserProfile>(x => list.Contains(x.Name));
        }