Esempio n. 1
0
 public RuleDbService(BatteryRepository br, LocationRepository lr, ApiiRepository ar, AmbientRepository ambRep)
 {
     this.brcontext     = br;
     this.lrcontext     = lr;
     this.arcontext     = ar;
     this.ambRepcontext = ambRep;
 }
Esempio n. 2
0
        // 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>();
        }
Esempio n. 3
0
 public AmbientsController(AmbientRepository repo)
 {
     _repo = repo;
 }