Пример #1
0
 public UnitOfWork()
 {
     _context         = new VivesRentalDbContext();
     Items            = new ItemRepository(_context);
     RentalItems      = new RentalItemRepository(_context);
     RentalOrders     = new RentalOrderRepository(_context);
     RentalOrderLines = new RentalOrderLineRepository(_context);
     Users            = new UserRepository(_context);
 }
        public UnitOfWork()
        {
            string connectionString = "server=MANNOBC96\\SQLEXPRESS;database=VivesRental;trusted_connection=true;";

            _context = new VivesRentalDbContext(connectionString);

            if (!_context.Database.Exists())
            {
                throw new NoDatabaseConnectionException();
            }

            Items            = new ItemRepository(_context);
            RentalItems      = new RentalItemRepository(_context);
            RentalOrders     = new RentalOrderRepository(_context);
            RentalOrderLines = new RentalOrderLineRepository(_context);
            Users            = new UserRepository(_context);
        }