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>())); }
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); }
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); }
public void RegisterSingleton <T>(Func <GenericRepositoryFactory, T> ctor) where T : class { _serviceStore.RegisterSingleton(x => ctor(this)); }