public GeofenceController()
 {
     _geofences          = new Dictionary <string, Geofence>();
     _geofenceRepository = new GeofenceRepository(DbContextFactory.CreateDeviceControllerContext(Startup.DbConfig.ToString()));
     //_logger = new Logger<IVListController>(LoggerFactory.Create(x => x.AddConsole()));
     Reload().ConfigureAwait(false).GetAwaiter().GetResult();
 }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FilterController"/> class.
 /// </summary>
 public FilterController(IConfigurationStore configStore, ILoggerFactory logger, IServiceExceptionHandler serviceExceptionHandler,
                         IProjectProxy projectProxy,
                         IProductivity3dV2ProxyNotification productivity3dV2ProxyNotification, IProductivity3dV2ProxyCompaction productivity3dV2ProxyCompaction,
                         IRepository <IFilterEvent> filterRepo, IRepository <IGeofenceEvent> geofenceRepo)
     : base(configStore, logger, serviceExceptionHandler, projectProxy, productivity3dV2ProxyNotification, productivity3dV2ProxyCompaction, "IFilterEvent")
 {
     Log                = logger.CreateLogger <FilterController>();
     this.filterRepo    = filterRepo as FilterRepository;
     geofenceRepository = geofenceRepo as GeofenceRepository;
 }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BoundaryController"/> class.
 /// </summary>
 public BoundaryController(IConfigurationStore configStore, ILoggerFactory logger,
                           IServiceExceptionHandler serviceExceptionHandler, IProjectProxy projectProxy,
                           IProductivity3dV2ProxyNotification productivity3dV2ProxyNotification, IProductivity3dV2ProxyCompaction productivity3dV2ProxyCompaction,
                           IRepository <IGeofenceEvent> geofenceRepo,
                           IRepository <IProjectEvent> projectRepo)
     : base(configStore, logger, serviceExceptionHandler, projectProxy, productivity3dV2ProxyNotification, productivity3dV2ProxyCompaction, "IBoundaryEvent")
 {
     Log = logger.CreateLogger <BoundaryController>();
     _geofenceRepository = geofenceRepo as GeofenceRepository;
     _projectRepository  = projectRepo as ProjectRepository;
 }
示例#4
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);
        }
示例#5
0
        //protected IGeofenceProxy GeofenceProxy;
        //protected IUnifiedProductivityProxy UnifiedProductivityProxy;

        public void SetupDI()
        {
            ServiceProvider = new ServiceCollection()
                              .AddLogging()
                              .AddHttpClient()
                              .AddSingleton(new LoggerFactory().AddSerilog(SerilogExtensions.Configure("VSS.Filter.ExecutorTests.log")))
                              .AddSingleton <IConfigurationStore, GenericConfiguration>()
                              .AddTransient <IRepository <IFilterEvent>, FilterRepository>()
                              .AddTransient <IRepository <IProjectEvent>, ProjectRepository>()
                              .AddTransient <IRepository <IGeofenceEvent>, GeofenceRepository>()
                              .AddTransient <IServiceExceptionHandler, ServiceExceptionHandler>()

                              // for serviceDiscovery
                              .AddServiceDiscovery()
                              .AddTransient <IWebRequest, GracefulWebRequest>()
                              .AddMemoryCache()
                              .AddSingleton <IDataCache, InMemoryDataCache>()

                              .AddTransient <IAssetResolverProxy, AssetResolverProxy>()
                              .AddTransient <IWebRequest, GracefulWebRequest>()
                              .AddTransient <IProductivity3dV2ProxyNotification, Productivity3dV2ProxyNotification>()
                              .AddTransient <IProductivity3dV2ProxyCompaction, Productivity3dV2ProxyCompaction>()
                              .AddTransient <IErrorCodesProvider, FilterErrorCodesProvider>()
                              .AddSingleton <IDataCache, InMemoryDataCache>()
                              //.AddSingleton<IGeofenceProxy, GeofenceProxy>()
                              //.AddSingleton<IUnifiedProductivityProxy, UnifiedProductivityProxy>()
                              .AddSingleton <IProjectProxy, ProjectV6Proxy>()
                              .AddSingleton <IFileImportProxy, FileImportV6Proxy>()
                              .BuildServiceProvider();

            ConfigStore                       = ServiceProvider.GetRequiredService <IConfigurationStore>();
            Logger                            = ServiceProvider.GetRequiredService <ILoggerFactory>();
            ServiceExceptionHandler           = ServiceProvider.GetRequiredService <IServiceExceptionHandler>();
            FilterRepo                        = ServiceProvider.GetRequiredService <IRepository <IFilterEvent> >() as FilterRepository;
            ProjectRepo                       = ServiceProvider.GetRequiredService <IRepository <IProjectEvent> >() as ProjectRepository;
            GeofenceRepo                      = ServiceProvider.GetRequiredService <IRepository <IGeofenceEvent> >() as GeofenceRepository;
            ProjectProxy                      = ServiceProvider.GetRequiredService <IProjectProxy>();
            FileImportProxy                   = ServiceProvider.GetRequiredService <IFileImportProxy>();
            Productivity3dV2ProxyNotification = ServiceProvider.GetRequiredService <IProductivity3dV2ProxyNotification>();
            Productivity3dV2ProxyCompaction   = ServiceProvider.GetRequiredService <IProductivity3dV2ProxyCompaction>();
            //GeofenceProxy = ServiceProvider.GetRequiredService<IGeofenceProxy>();
            //UnifiedProductivityProxy = ServiceProvider.GetRequiredService<IUnifiedProductivityProxy>();

            Assert.IsNotNull(ServiceProvider.GetService <ILoggerFactory>());
        }
示例#6
0
        public void SetupLoggingAndRepos()
        {
            ServiceProvider = new ServiceCollection()
                              .AddLogging()
                              .AddHttpClient()
                              .AddSingleton(new LoggerFactory().AddSerilog(SerilogExtensions.Configure("VSS.Filter.Repository.Tests.log")))
                              .AddSingleton <IConfigurationStore, GenericConfiguration>()
                              .AddTransient <IRepository <IFilterEvent>, FilterRepository>()
                              .AddTransient <IRepository <IProjectEvent>, ProjectRepository>()
                              .AddTransient <IRepository <IGeofenceEvent>, GeofenceRepository>()
                              .AddMemoryCache()
                              .AddSingleton <IDataCache, InMemoryDataCache>()
                              .BuildServiceProvider();

            ConfigStore  = ServiceProvider.GetRequiredService <IConfigurationStore>();
            FilterRepo   = ServiceProvider.GetRequiredService <IRepository <IFilterEvent> >() as FilterRepository;
            ProjectRepo  = ServiceProvider.GetRequiredService <IRepository <IProjectEvent> >() as ProjectRepository;
            GeofenceRepo = ServiceProvider.GetRequiredService <IRepository <IGeofenceEvent> >() as GeofenceRepository;
            Assert.IsNotNull(ServiceProvider.GetService <ILoggerFactory>());
        }