public DataServiceController(IContractsRepository cntrcRep, ITradersRepository trdrRep, IOrdersRepository ordRep, IInvoicesRepository invRep, IItemsRepository itmRep, IAirportsRepository airRep, IAircraftsRepository acrRep, ICurrenciesRepository curRep) { _contractsRepository = cntrcRep; _tradersRepository = trdrRep; _ordersRepository = ordRep; _invoicesRepository = invRep; _itemsRepository = itmRep; _airportsRepository = airRep; _aircraftsRepository = acrRep; _currenciesRepository = curRep; }
public void PrepareRepositories(bool initialize = false) { // Kick the model creation process if not already created (hence force is false). In other words, do // not wait on any database activities. Without this, nothing happens unless some context activities take // place. _context = new AviTradeContext(); if (initialize) { // Kick the model creation process if not already created (hence force is false). In other words, do // not wait on any database activities. Without this, nothing happens unless some context activities take // place. _context.Database.Initialize(force: false); } _contractsRepository = new ContractsRepository(_context); _airportsRepository = new AirportsRepository(_context); _aircraftsRepository = new AircraftsRepository(_context); _itemsRepository = new ItemsRepository(_context); _currenciesRepository = new CurrenciesRepository(_context); _periodsRepository = new PeriodsRepository(_context); _invoicesRepository = new InvoicesRepository(_context, _periodsRepository); _ordersRepository = new OrdersRepository(_context, _contractsRepository, _airportsRepository, _aircraftsRepository, _itemsRepository, _currenciesRepository, _invoicesRepository); _tradersRepository = new TradersRepository(_context); }