Exemplo n.º 1
0
        private static void Publish <T>(T message) where T : Message
        {
            var messageType = message.MessageType;

            if (messageType.Equals("DomainNotification"))
            {
                var obj = new DomainNotificationHandler();
                ((IDomainNotificationHandler <T>)obj).Handle(message);
            }

            if (messageType.Equals("AddCustomerCommand") ||
                messageType.Equals("UpdateCustomerCommand") ||
                messageType.Equals("DeleteCustomerCommand"))
            {
                var obj = new CustomerCommandHandler(new FakeCustomerRepository(), new FakeUow(), new FakeBus(), new DomainNotificationHandler());
                ((IHandler <T>)obj).Handle(message);
            }

            if (messageType.Equals("AddedCustomerEvent") ||
                messageType.Equals("UpdatedCustomerEvent") ||
                messageType.Equals("DeletedCustomerEvent"))
            {
                var obj = new CustomerEventHandler();
                ((IHandler <T>)obj).Handle(message);
            }
        }
Exemplo n.º 2
0
    private static void RegisterDomainEventHandlers(ContainerBuilder builder)
    {
        var registryBuilder = new DomainEventHandlerRegistryBuilder(builder);

        CustomerEventHandler.Register(registryBuilder);

        builder.RegisterInstance(registryBuilder.Build());
    }
Exemplo n.º 3
0
        protected CustomerEventArgs OnNewCustomerRequested()
        {
            CustomerEventArgs    result = null;
            CustomerEventHandler newCustomerRequested = NewCustomerRequested;

            if (newCustomerRequested != null)
            {
                CustomerEventArgs args = null;
                result = newCustomerRequested(this, args);
            }
            return(result);
        }