Example #1
0
 public HomeRepository()
 {
     Adapter = new DbContextAdapter(ContextFactory.GetContext(ContextFactory.DBKey.SALES));
     Unit_OfWork = new UnitOfWork(Adapter);
     ProductRepo = new Repository<Product>(Adapter);
     CatRepo = new Repository<ProductCategory>(Adapter);
 }
Example #2
0
        public void CreateContext()
        {
            _ctx = new Context();
            _adp = new DbContextAdapter(_ctx);

            _catRepo    = new Repository <ProductCategory>(_adp);
            _unitOfWork = new UnitOfWork(_adp);
        }
        public void CreateContext()
        {
            _ctx = new Context();
            _adp = new DbContextAdapter(_ctx);

            _catRepo = new Repository<ProductCategory>(_adp);
            _unitOfWork = new UnitOfWork(_adp);
        }
        public void CreateContext()
        {
            _ctx = new TestingContext();
            _adp = new DbContextAdapter(_ctx);

            _productRepo = new Repository<Product>(_adp);
            _catRepo = new Repository<ProductCategory>(_adp);
        }
        public CustomerRepository()
        {
            Mapper.CreateMap<DomainModels.Customer, Customer>();
              Mapper.CreateMap<Customer, DomainModels.Customer>();

              DbContext context = new RETAILContext();
              DbContextAdapter contextAdaptor = new DbContextAdapter(context);

              IObjectSetFactory objectSetFactory = contextAdaptor;
              _repository = new Repository<Customer>(objectSetFactory);

              IObjectContext objectContext = contextAdaptor;
              _uow = new UnitOfWork(objectContext);
        }
        public void Commit_Store_Elements()
        {
            ProductCategory cat = new ProductCategory {Name = "Temporary cat"};
            _catRepo.Insert(cat);
            _unitOfWork.Commit();

            Assert.That(cat, Has.Property("Id").GreaterThan(0));

            using (var ctx = new Context())
            {
                var adp = new DbContextAdapter(ctx);
                var repo = new Repository<ProductCategory>(adp);

                Assert.That(repo.First(pc => pc.Name == cat.Name), Is.Not.Null);
            }
        }
        public CustomerRepository()
        {
            Mapper.CreateMap <DomainModels.Customer, Customer>();
            Mapper.CreateMap <Customer, DomainModels.Customer>();

            DbContext        context        = new RETAILContext();
            DbContextAdapter contextAdaptor = new DbContextAdapter(context);

            IObjectSetFactory objectSetFactory = contextAdaptor;

            _repository = new Repository <Customer>(objectSetFactory);

            IObjectContext objectContext = contextAdaptor;

            _uow = new UnitOfWork(objectContext);
        }
Example #8
0
        public void RepositoryTest()
        {
            var context        = new PavimentalContext();
            var contextAdapter = new DbContextAdapter(context);
            var unitOfWork     = new UnitOfWork(contextAdapter);

            var teamRepository = new BaseRepository <Area>(contextAdapter);
            var newArea        = new Area {
                Nome = "Da Bears"
            };

            teamRepository.Add(newArea);
            unitOfWork.Commit();



            context.Dispose();
        }
Example #9
0
        public void Commit_Store_Elements()
        {
            ProductCategory cat = new ProductCategory {
                Name = "Temporary cat"
            };

            _catRepo.Insert(cat);
            _unitOfWork.Commit();

            Assert.That(cat, Has.Property("Id").GreaterThan(0));

            using (var ctx = new Context())
            {
                var adp  = new DbContextAdapter(ctx);
                var repo = new Repository <ProductCategory>(adp);

                Assert.That(repo.First(pc => pc.Name == cat.Name), Is.Not.Null);
            }
        }
 public RepositoryFactory()
 {
     context = new HcmisContext();
     adapter = new DbContextAdapter(context);
 }
 public void CreateContext()
 {
     _ctx = new mobileContext();
     _adp = new DbContextAdapter(_ctx);
     _bullRepo = new Repository<Bull>(_adp);
 }
Example #12
0
 public void CreateContext()
 {
     ctx = new FlowUsersEntities();
     adp = new FlowUsersContextAdapter(ctx);
     uow = new FlowUsersUnitOfWork(adp);
 }
 public RepositoryFactory()
 {
     context = new HcmisContext();
         adapter = new DbContextAdapter(context);
 }
Example #14
0
 public void MyTestInitialize()
 {
     ctx = new FlowDocsEntities();
     adp = new FlowDocsContextAdapter(ctx);
     uow = new FlowDocsUnitOfWork(adp);
 }