示例#1
0
        public static IBrighterHandlerBuilder BrighterHandlerBuilder(IServiceCollection services, BrighterOptions options)
        {
            var subscriberRegistry = new ServiceCollectionSubscriberRegistry(services);

            services.AddSingleton <ServiceCollectionSubscriberRegistry>(subscriberRegistry);

            services.Add(new ServiceDescriptor(typeof(IAmACommandProcessor), BuildCommandProcessor, options.CommandProcessorLifetime));

            var mapperRegistry = new ServiceCollectionMessageMapperRegistry(services);

            services.AddSingleton <ServiceCollectionMessageMapperRegistry>(mapperRegistry);

            return(new ServiceCollectionBrighterBuilder(services, subscriberRegistry, mapperRegistry));
        }
 public ServiceCollectionBrighterBuilder(IServiceCollection services, ServiceCollectionSubscriberRegistry serviceCollectionSubscriberRegistry, ServiceCollectionMessageMapperRegistry mapperRegistry)
 {
     Services = services;
     _serviceCollectionSubscriberRegistry = serviceCollectionSubscriberRegistry;
     _mapperRegistry = mapperRegistry;
 }