Esempio n. 1
0
        public async Task RegisterEventHandlers(IContainer container)
        {
            var eventHandlers = this.GetHandlers(typeof(IEventHandler <>));

            foreach (var handler in eventHandlers)
            {
                var builder         = new RegistrationProcessBuilder <IEventBus>(handler, container);
                var registerProcess = builder.Build(
                    serviceName: this._service,
                    handleMethodName: nameof(IEventHandler <IEvent> .Handle),
                    messageBusRegistrationMethodName: nameof(IEventBus.Subscribe)
                    );

                await registerProcess;
            }
        }
Esempio n. 2
0
        public async Task RegisterCommandHandlersWithResponse(IContainer container)
        {
            var commandHandlers = this.GetHandlers(typeof(ICommandHandler <,>));

            foreach (var handler in commandHandlers)
            {
                var builder         = new RegistrationProcessBuilder <ICommandBus>(handler, container);
                var registerProcess = builder.Build(
                    serviceName: this._service,
                    handleMethodName: nameof(ICommandHandler <ICommand, IMessage> .Handle),
                    messageBusRegistrationMethodName: nameof(ICommandBus.RegisterHandler)
                    );

                await registerProcess;
            }
        }