예제 #1
0
        public void WhereOr()
        {
            var q = Builders <MyModel> .Select(x => new { x.Id })
                    .Where(x => x.Id == 1 || x.Name == "test");

            var b = WhereBuilder <MyModel> .Or(
                WhereBuilder <MyModel> .Eq(x => x.Id, 1),
                WhereBuilder <MyModel> .Eq(x => x.Name, "test"));

            Utils.AssertRawQuery(q, b, @"SELECT ""id"" FROM model WHERE ((""id"") = (1)) OR ((""name"") = ('test'))");
        }
예제 #2
0
        public void WhereAnd()
        {
            var q = Builders <MyModel> .Select(x => new { x.Id })
                    .Where(x => x.Id == 1 && x.Name == "test");

            var b = WhereBuilder <MyModel> .And(
                WhereBuilder <MyModel> .FromExpression(x => x.Id == 1),
                WhereBuilder <MyModel> .Eq(x => x.Name, "test"));

            Utils.AssertRawQuery(q, b, @"SELECT ""id"" FROM model WHERE ((""id"") = (1)) AND ((""name"") = ('test'))");
        }