public RuleDbService(BatteryRepository br, LocationRepository lr, ApiiRepository ar, AmbientRepository ambRep) { this.brcontext = br; this.lrcontext = lr; this.arcontext = ar; this.ambRepcontext = ambRep; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var config = new ServerConfig(); Configuration.Bind(config); var databaseContext = new DatabaseContext(config.MongoDB); var repo1 = new AmbientRepository(databaseContext); services.AddSingleton <AmbientRepository>(repo1); var repo2 = new ApiiRepository(databaseContext); services.AddSingleton <ApiiRepository>(repo2); var repo3 = new BatteryRepository(databaseContext); services.AddSingleton <BatteryRepository>(repo3); var repo4 = new LocationRepository(databaseContext); services.AddSingleton <LocationRepository>(repo4); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddHostedService <RuleDbService>(); }
public AmbientsController(AmbientRepository repo) { _repo = repo; }