Exemple #1
0
        public static IServiceCollection AddServiceBus(
            this IServiceCollection services, Action <ServiceBusOptions> configure)
        {
            Guard.AgainstNull(nameof(services), services);
            Guard.AgainstNull(nameof(configure), configure);

            var options = new ServiceBusOptions();

            configure(options);
            return(AddBus(services, options));
        }
Exemple #2
0
 private static IServiceCollection AddBus(
     this IServiceCollection services, ServiceBusOptions options)
 {
     services = AddEventService(services, options.Events);
     services = AddRequestService(services, options.Requests);
     services = AddAuthorizationService(services, options.Authorization);
     services = AddValidationService(services);
     services.AddSingleton(options);
     services.TryAdd(ServiceDescriptor.Transient <IServiceBus, ServiceBus>());
     return(services);
 }
Exemple #3
0
        public ServiceBus(
            ServiceBusOptions options,
            IEventService eventService,
            IRequestService requestService,
            IValidationService validationService,
            IAuthorizationService authorizationService)
        {
            Guard.AgainstNull(nameof(options), options);
            Guard.AgainstNull(nameof(eventService), eventService);
            Guard.AgainstNull(nameof(requestService), requestService);
            Guard.AgainstNull(nameof(validationService), validationService);
            Guard.AgainstNull(nameof(authorizationService), authorizationService);

            this.options              = options;
            this.eventService         = eventService;
            this.requestService       = requestService;
            this.validationService    = validationService;
            this.authorizationService = authorizationService;
        }