Exemplo n.º 1
0
        private static void RegisterEventHandlers(Bus.Bus bus, IReadModelFacade readModel, IDtoManager dtoManager)
        {
            var eventHandlersAssemblies = new[] { Assembly.Load(new AssemblyName("ECom.ReadModel")) };

            MessageHandlersRegister.RegisterEventHandlers(eventHandlersAssemblies, bus, dtoManager, readModel);

            var mailSender = new MailGunEmailSender(ConfigurationManager.AppSettings["MailGunApiKey"], ConfigurationManager.AppSettings["MailGunAppDomain"]);
            var mailBodyGenerator = new RazorMessageBodyGenerator();
            var emailService = new EmailService(mailSender, readModel, mailBodyGenerator);

            bus.RegisterHandler<OrderSubmited>(emailService.Handle);
        }
Exemplo n.º 2
0
        private static void RegisterEventHandlers(Bus.Bus bus, IDtoManager dtoManager)
        {
            var eventHandlersAssemblies = new[] { Assembly.Load(new AssemblyName("ECom.ReadModel")) };
            MessageHandlersRegister.RegisterEventHandlers(eventHandlersAssemblies, bus, dtoManager);

            var mailSender = new MailGunEmailSender(ConfigurationManager.AppSettings["MailGunApiKey"], ConfigurationManager.AppSettings["MailGunAppDomain"]);
            var mailBodyGenerator = new RazorMessageBodyGenerator();
            var emailService = new EmailService(mailSender, new UserDetailsView(dtoManager), mailBodyGenerator);

            bus.RegisterHandler<OrderSubmited>(e => Task.Factory.StartNew(() => emailService.Handle(e)));
        }