Beispiel #1
0
        public void TestMethod1()
        {
            var dbContext = new DanwuDbContext();
            var context = new EntityFrameworkRepositoryContext();
            var unitOfWork = new EntityFrameworkUnitOfWork(dbContext);
            IUserRepository userRepository = new UserRepository(context);
            userRepository.Create(new User()
            {
                UserName = "******",
                NickName = "坏坏男孩",
                RealName = "吴丹",
                PhoneNum = "18916765826",
                Email = "*****@*****.**",
                Status = UserStatus.Enabled,
                PassWord = "******",
                RegisterTime = DateTime.Now,
                LastLogonTime = DateTime.Now
            });
            userRepository.Create(new User()
            {
                UserName = "******",
                NickName = "坏坏男孩1",
                RealName = "吴丹1",
                PhoneNum = "18916765000",
                Email = "*****@*****.**",
                Status = UserStatus.Disabled,
                PassWord = "******",
                RegisterTime = DateTime.Now,
                LastLogonTime = DateTime.Now
            });

            var result = context.Commit();
            //var result = unitOfWork.Commit();
        }
Beispiel #2
0
        public void TestMethod2() {
            var dbContext = new DanwuDbContext();
            var context = new EntityFrameworkRepositoryContext();
            var unitOfWork = new EntityFrameworkUnitOfWork(dbContext);
            IUserRepository userRepository = new UserRepository(context);
            var users = userRepository.QueryAll();

            //users=userRepository.QueryBy(
        }