CQRSSample.Infrastructure.BootStrapper.SetupDomainEventHandlers C# (CSharp) Method

SetupDomainEventHandlers() private static method

private static SetupDomainEventHandlers ( IBus bus, IDocumentStore documentStore ) : void
bus IBus
documentStore IDocumentStore
return void
        private static void SetupDomainEventHandlers(IBus bus, IDocumentStore documentStore)
        {
            //TODO: Resolve through IoC

            var view = new CustomerListView(documentStore);
            bus.RegisterHandler<CustomerCreatedEvent>(view.Handle);
            bus.RegisterHandler<CustomerRelocatedEvent>(view.Handle);

            var addressView = new CustomerAddressView(documentStore);
            bus.RegisterHandler<CustomerCreatedEvent>(addressView.Handle);
            bus.RegisterHandler<CustomerRelocatedEvent>(addressView.Handle);
        }