コード例 #1
0
        void Test2()
        {
            Users     user  = new Users();
            UserRoles roles = new UserRoles()
            {
                RoleName = "role1"
            };

            OQL q2 = new OQL(user);

            q2.InnerJoin(roles).On(user.RoleID, roles.ID);

            OQLCompare cmp       = new OQLCompare(q2);
            OQLCompare cmpResult =
                (
                    cmp.Property(user.UserName) == "ABC" &
                    cmp.Comparer(user.Password, "=", "111") &
                    cmp.EqualValue(roles.RoleName)
                )
                |
                (
                    (cmp.Comparer(user.UserName, "=", "CDE") &
                     cmp.Property(user.Password) == "222" &
                     cmp.Comparer(roles.RoleName, "like", "%Role2")
                    )
                    |
                    (cmp.Property(user.LastLoginTime) > DateTime.Now.AddDays(-1))
                )
            ;

            q2.Select().Where(cmpResult);
            Console.WriteLine("OQL by OQLCompare Test:\r\n{0}", q2);
            Console.WriteLine(q2.PrintParameterInfo());
        }