private void ConstructDependencies() { Configuration = new ConfigurationBuilder() .SetBasePath(AppDomain.CurrentDomain.BaseDirectory) .AddJsonFile("appsettings.json") .Build(); var services = new ServiceCollection(); services.AddScoped <IConfiguration>( serviceProvier => Configuration ); services.AddDbContext <MsiDatabase>( options => options.EnableSensitiveDataLogging(true) ); services.AddScoped <ICompanyRecords, Logic.CompanyRecords>(); var serviceProvider = services.BuildServiceProvider(); CompanyRecords = serviceProvider.GetService <ICompanyRecords>(); MsiDatabase = serviceProvider.GetService <MsiDatabase>(); }
public CompanyRecordsController(IConfiguration configuration, ICompanyRecords companyRecords) { _companyRecords = companyRecords; }