예제 #1
0
 public IVListController()
 {
     _ivLists          = new Dictionary <string, IVList>();
     _ivListRepository = new IVListRepository(DbContextFactory.CreateDeviceControllerContext(Startup.DbConfig.ToString()));
     //_logger = new Logger<IVListController>(LoggerFactory.Create(x => x.AddConsole()));
     Reload().ConfigureAwait(false).GetAwaiter().GetResult();
 }
예제 #2
0
        /// <summary>
        /// Api Controller
        /// </summary>
        /// <param name="context"></param>
        /// <param name="logger"></param>
        public ApiController(DeviceControllerContext context, ILogger <DeviceController> logger)
        {
            _context = context;
            _logger  = logger;

            // TODO: Maybe use the DbContextFactory instead of relying on the same one per repo
            _accountRepository     = new AccountRepository(_context);
            _deviceRepository      = new DeviceRepository(_context);
            _instanceRepository    = new InstanceRepository(_context);
            _assignmentRepository  = new AssignmentRepository(_context);
            _geofenceRepository    = new GeofenceRepository(_context);
            _webhookRepository     = new WebhookRepository(_context);
            _deviceGroupRepository = new DeviceGroupRepository(_context);
            _ivListRepository      = new IVListRepository(_context);
        }