private void _setupEvents(IApplicationBuilder app, IHostingEnvironment env)
        {
            var Context          = app.ApplicationServices.GetService <ProfileContext>();
            var dbContextOptions = new DbContextOptionsBuilder <ProfileContext>().UseSqlServer(Configuration.GetConnectionString("VacationDatabase")).Options;
            var _rawRabbitClient = app.ApplicationServices.GetService <IBusClient>();
            var _profileHandle   = new AccountCreatedHandlers(dbContextOptions);

            _rawRabbitClient.SubscribeAsync <AccountCreatedForEmail>(_profileHandle.HandleAsync);
        }
Пример #2
0
        private void _setupEvents(IApplicationBuilder app, IHostingEnvironment env)
        {
            var Context          = app.ApplicationServices.GetService <MessageContext>();
            var dbContextOptions = new DbContextOptionsBuilder <MessageContext>().UseSqlServer(Configuration.GetConnectionString("NotificationDatabase")).Options;
            var _rawRabbitClient = app.ApplicationServices.GetService <IBusClient>();
            var configSendMail   = app.ApplicationServices.GetRequiredService <IOptions <ConfigSendEmail> >();


            var _accountCreatedHandle = new AccountCreatedHandlers(_rawRabbitClient, env, configSendMail, dbContextOptions);

            _rawRabbitClient.SubscribeAsync <AccountCreatedForEmail>(_accountCreatedHandle.HandleAsync);

            var _requestGorgotPasswordHandle = new RequestForgotPasswordForEmailHandler(_rawRabbitClient, env, configSendMail, dbContextOptions);

            _rawRabbitClient.SubscribeAsync <RequestForgotPasswordForEmail>(_requestGorgotPasswordHandle.HandleAsync);
        }