Пример #1
0
 public static IServiceCollection AddUpdatesProvider <TProvider>(
     this IServiceCollection services,
     UpdatesProviderBaseConfig config) where TProvider : class, IUpdatesProvider
 {
     return(services
            .AddSingleton(config)
            .AddSingleton <IUpdatesProvider, TProvider>());
 }
Пример #2
0
        public static IServiceCollection AddUpdatesProducer <TProvider>(
            this IServiceCollection services,
            MongoDbConfig mongoDbConfig,
            RabbitMqConfig rabbitMqConfig,
            UpdatesProviderBaseConfig updatesProviderBaseConfig,
            PollerConfig pollerConfig,
            VideoExtractorConfig videoExtractorConfig) where TProvider : class, IUpdatesProvider
        {
            services = mongoDbConfig != null
                ? services.AddUpdatesProducerMongoRepositories(mongoDbConfig)
                : services.AddUpdatesProducerMockRepositories();

            return(services
                   .AddRabbitMqUpdatesPublisher(rabbitMqConfig)
                   .AddVideoExtractor(videoExtractorConfig)
                   .AddUpdatesProvider <TProvider>(updatesProviderBaseConfig)
                   .AddUpdatesPollerService(pollerConfig));
        }