//Dependency Inversion //Instead of being dependent on the database //Change the dependency direction //dependency injection public LotsController(//ApplicationDbContext dbContext ILotRepo lotRepo, ILotTypeRepo lotTypeRepo) { //this.database = dbContext; this.iLotRepo = lotRepo; this.iLotTypeRepo = lotTypeRepo; }
//ctor <tab> <tab> public PermitsController(IPermitRepo permitRepo, ILotRepo lotRepo, ILotStatusRepo lotStatusRepo, IApplicationUserRepo applicationUserRepo) { this.iPermitRepo = permitRepo; this.iLotRepo = lotRepo; this.iLotStatusRepo = lotStatusRepo; this.iApplicationUserRepo = applicationUserRepo; }
public HomeController(ILogger <HomeController> logger, ILotRepo lotRepo) { _logger = logger; this.iLotRepo = lotRepo; }