示例#1
0
		public static void RegisterAllServices(this IServiceStore store)
		{
			store.RegisterSingleton<ILogger>(new DiagnosticLogger());
			store.RegisterSingleton(CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["RedMonitoreo:AzureStorage"].ConnectionString));
			store.RegisterSingleton<IStationSensorStatePersister>(c=> new StationSensorStatePersister(c.GetInstance<CloudStorageAccount>()));
			store.RegisterSingleton<IEnqueuer<StationSensorHourlyStateChanged>>(c=> new MessageEnqueuer<StationSensorHourlyStateChanged>(c.GetInstance<CloudStorageAccount>()));
		}
示例#2
0
        public GenericRepositoryFactory()
        {
            var simple = new SimpleServiceContainer();

            _container    = simple;
            _serviceStore = simple;
        }
示例#3
0
        public static void RegisterApplicationViewModels(this IServiceStore store, IServiceContainer container)
        {
            var appViewmodelsExposer = new MainViewModelExposer();

            appViewmodelsExposer.UseViewModelsFactory(t => container.GetInstance(t) as ViewModelBase); // <== si no está registrado directamente usa el IoC para obtener una instancia del viewmodel

            store.RegisterSingleton <IViewModelExposer>(appViewmodelsExposer);

            RegisterViewModels(store);
            RegisterReports(store);
        }
示例#4
0
 private static void RegisterViewModels(IServiceStore store)
 {
     // Cuando se pida de exponer EnvioDocumentosAFilialViewModel se termina ejecutando este metodo
     //store.RegisterTransient(c => new MarcaViewModel(
     //    c.GetInstance<IViewModelExposer>()
     //    , c.GetInstance<IMarcaRepository>()
     //    , c.GetInstance<IModeloRepository>()));
     //store.RegisterTransient(c => new MarcaViewModel());
     store.RegisterTransient(c => new MarcaViewModel(c.GetInstance <IMarcaRepository>()));
     store.RegisterTransient(c => new ModeloViewModel());
 }
示例#5
0
 public void ConstructorShouldThrowArgumentExceptionWhenNullParameterGiven(
     IServiceChecker serviceChecker,
     IServiceStore serviceStore,
     IOptions <BackgroundCheckerConfiguration> configuration,
     INotificationService notificationService,
     ILogger <BackgroundChecker> logger)
 {
     Assert.Throws <ArgumentNullException>(() => new BackgroundChecker(serviceChecker,
                                                                       serviceStore,
                                                                       configuration,
                                                                       notificationService,
                                                                       logger));
 }
示例#6
0
 public GenericRepositoryFactory(IServiceContainer container, IServiceStore serviceStore)
 {
     if (container == null)
     {
         throw new ArgumentNullException(nameof(container));
     }
     if (serviceStore == null)
     {
         throw new ArgumentNullException(nameof(serviceStore));
     }
     this._container    = container;
     this._serviceStore = serviceStore;
 }
示例#7
0
 private static void RegisterAllControllers(IServiceStore store)
 {
     store.RegisterTransient(
         c => new OtfsController(c.GetInstance <IStationFileStore>(), c.GetInstance <IEnqueuer <StationFileToProcess> >()));
     store.RegisterTransient(c => new StationsController(c.GetInstance <IStationsSensorsYearActivityPersister>()));
     store.RegisterTransient(c => new SensorsController(
                                 c.GetInstance <IStationsSensorsYearActivityPersister>()
                                 , c.GetInstance <IStationSensorDailyStatePersister>()
                                 , c.GetInstance <IStationSensorHourlyStatePersister>()
                                 , c.GetInstance <IStationSensorStatePersister>()
                                 , c.GetInstance <IStationSensorStateDeleter>()
                                 , c.GetInstance <IEnqueuer <StationSensorHourlyStateChanged> >(),
                                 c.GetInstance <IStationSensorStateAdder>()
                                 ));
 }
示例#8
0
 public StoreWrapper(
     IServiceStore serviceStore,
     IExtraStore extraStore,
     IManufacturerStore manufacturerStore,
     ISlipwayStore slipwayStore,
     IWaterStore waterStore,
     IPortStore portStore)
 {
     Services      = serviceStore;
     Extras        = extraStore;
     Manufacturers = manufacturerStore;
     Slipways      = slipwayStore;
     Waters        = waterStore;
     Ports         = portStore;
 }
示例#9
0
        public BackgroundChecker(IServiceChecker serviceChecker,
                                 IServiceStore serviceStore,
                                 IOptions <BackgroundCheckerConfiguration> configuration,
                                 INotificationService notificationService,
                                 ILogger <BackgroundChecker> logger)
        {
            Guard.Against.Null(serviceChecker, nameof(serviceChecker));
            Guard.Against.Null(serviceStore, nameof(serviceStore));
            Guard.Against.Null(configuration, nameof(configuration));
            Guard.Against.Null(notificationService, nameof(notificationService));
            Guard.Against.Null(logger, nameof(logger));

            _serviceChecker      = serviceChecker;
            _serviceStore        = serviceStore;
            _configuration       = configuration.Value;
            _notificationService = notificationService;
            _logger = logger;
        }
示例#10
0
 public static void RegisterAllServices(this IServiceStore store)
 {
     store.RegisterSingleton <ILogger>(container => new DiagnosticLogger());
     store.RegisterSingleton(CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["RedMonitoreo:AzureStorage"].ConnectionString));
     store.RegisterSingleton <IStationFileStore>(c => new BlobStationFileStore(c.GetInstance <CloudStorageAccount>()));
     store.RegisterSingleton <IEnqueuer <StationFileToProcess> >(c =>
                                                                 new ServiceBusEnqueuer <StationFileToProcess>(
                                                                     ConfigurationManager.ConnectionStrings["RedMonitoreo:ServiceBus:FilesToProcess"].ConnectionString
                                                                     , c.GetInstance <ILogger>()));
     store.RegisterSingleton <IEnqueuer <StationSensorHourlyStateChanged> >(c =>
                                                                            new MessageEnqueuer <StationSensorHourlyStateChanged>(c.GetInstance <CloudStorageAccount>()));
     store.RegisterSingleton <IStationsSensorsYearActivityPersister>(c => new StationsSensorsYearActivityPersister(c.GetInstance <CloudStorageAccount>()));
     store.RegisterSingleton <IStationSensorDailyStatePersister>(c => new StationSensorDailyStatePersister(c.GetInstance <CloudStorageAccount>()));
     store.RegisterSingleton <IStationSensorHourlyStatePersister>(c => new StationSensorHourlyStatePersister(c.GetInstance <CloudStorageAccount>()));
     store.RegisterSingleton <IStationSensorStatePersister>(c => new StationSensorStatePersister(c.GetInstance <CloudStorageAccount>()));
     store.RegisterSingleton <IStationSensorStateDeleter>(c => new StationSensorStateDeleter(c.GetInstance <CloudStorageAccount>()));
     store.RegisterSingleton <IStationSensorStateAdder>(c => new StationSensorStateAdder(c.GetInstance <CloudStorageAccount>()));
     RegisterAllControllers(store);
 }
示例#11
0
 public static void RegisterJobs(this IServiceStore store)
 {
     store.RegisterTransient(c => new StationFileToProcessConsumer(
                                 c.GetInstance <IStationFileStore>()
                                 , c.GetInstance <IStationSensorStatePersister>()
                                 , c.GetInstance <IEnqueuer <StationSensorHourlyStateChanged> >()
                                 , c.GetInstance <ILogger>()
                                 ));
     store.RegisterTransient(c => new StationSensorHourlyStateChangedConsumer(
                                 c.GetInstance <IStationSensorStatePersister>()
                                 , c.GetInstance <IStationSensorHourlyStatePersister>()
                                 , c.GetInstance <IEnqueuer <StationSensorDayStateChanged> >()
                                 , c.GetInstance <ILogger>()
                                 ));
     store.RegisterTransient(c => new StationSensorDayStateChangedConsumer(
                                 c.GetInstance <IStationSensorHourlyStatePersister>()
                                 , c.GetInstance <IStationSensorDailyStatePersister>()
                                 , c.GetInstance <IStationsSensorsYearActivityPersister>()
                                 , c.GetInstance <ILogger>()
                                 ));
 }
示例#12
0
        public void Setup()
        {
            var builder = new WebHostBuilder()
                          .ConfigureServices((_, services) =>
            {
                services.AddServiceRegistry(options =>
                {
                    options.SelfRegistration.SelfRegister = true;
                    options.SelfRegistration.ServiceId    = "TestSelfService";
                    options.SelfRegistration.DisplayName  = "My Test";
                    options.SelfRegistration.Endpoints    = new[] { new Uri("http://selfservice.com") };
                }).AddInMemoryStore();
                services.AddDataProtection().PersistKeysToInMemory();
            })
                          .Configure(app =>
            {
                app.UseServiceRegistry();
                _serviceStore = app.ApplicationServices.GetRequiredService <IServiceStore>();
            });

            _testServer = new TestServer(builder);
            _client     = _testServer.CreateClient();
        }
示例#13
0
 private static void RegisterReports(IServiceStore store)
 {
     store.RegisterTransient(c => new MarcaReportViewModel(c.GetInstance <IReportsProvider>()));
 }
示例#14
0
		public static void RegisterJobs(this IServiceStore store)
		{
			store.RegisterTransient(c=> new StreamSensorAverageConsumer(
				c.GetInstance<IStationSensorStatePersister>()
				, c.GetInstance<IEnqueuer<StationSensorHourlyStateChanged>>()));
		}
示例#15
0
 public ServiceController(IServiceStore serviceStore, IServiceChecker serviceChecker)
 {
     _serviceStore   = serviceStore;
     _serviceChecker = serviceChecker;
 }
示例#16
0
 public ServiceController(ILogger <ServiceController> logger, IServiceStore serviceStore)
 {
     _logger       = logger;
     _serviceStore = serviceStore;
 }
示例#17
0
 public ServiceRegistry(IServiceStore store, IRegistrationTokenProvider tokenProvider)
 {
     _store         = store ?? throw new ArgumentNullException(nameof(store));
     _tokenProvider = tokenProvider ?? throw new ArgumentNullException(nameof(tokenProvider));
 }
 public HomeController(IServiceStore serviceStore)
 {
     _serviceStore = serviceStore ?? throw new ArgumentNullException(nameof(serviceStore));
 }
示例#19
0
 public ServiceManager(IUnitOfWork unitOfWork, IServiceStore serviceStore)
 {
     _unitOfWork   = unitOfWork;
     _serviceStore = serviceStore;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CachingServiceStore{T}"/> class.
 /// </summary>
 /// <param name="inner">The inner store.</param>
 /// <param name="cache">The cache instance.</param>
 /// <param name="options">The options.</param>
 public CachingServiceStore(T inner, ICache <Service> cache, ServiceRegistryOptions options)
 {
     _inner   = inner ?? throw new ArgumentNullException(nameof(inner));
     _cache   = cache ?? throw new ArgumentNullException(nameof(cache));
     _options = options ?? throw new ArgumentNullException(nameof(options));
 }