private IServiceProvider CreateAutofacServiceProvider(IServiceCollection services)
        {
            var containerBuilder = new ContainerBuilder();

            containerBuilder.Populate(services);

            containerBuilder.RegisterModule(new MeetingsAutofacModule());
            containerBuilder.RegisterModule(new AdministrationAutofacModule());
            containerBuilder.RegisterModule(new UserAccessAutofacModule());
            containerBuilder.RegisterModule(new PaymentsAutofacModule());

            var container = containerBuilder.Build();

            var httpContextAccessor      = container.Resolve <IHttpContextAccessor>();
            var executionContextAccessor = new ExecutionContextAccessor(httpContextAccessor);

            var emailsConfiguration = new EmailsConfiguration(_configuration["EmailsConfiguration:FromEmail"]);

            MeetingsStartup.Initialize(this._configuration[MeetingsConnectionString], executionContextAccessor, _logger, emailsConfiguration);
            AdministrationStartup.Initialize(this._configuration[MeetingsConnectionString], executionContextAccessor, _logger);
            UserAccessStartup.Initialize(
                this._configuration[MeetingsConnectionString],
                executionContextAccessor,
                _logger,
                emailsConfiguration,
                this._configuration["Security:TextEncryptionKey"],
                null);
            PaymentsStartup.Initialize(
                this._configuration[MeetingsConnectionString],
                executionContextAccessor,
                _logger,
                null);

            return(new AutofacServiceProvider(container));
        }
예제 #2
0
        private void InitializeModules(ILifetimeScope container)
        {
            var httpContextAccessor      = container.Resolve <IHttpContextAccessor>();
            var executionContextAccessor = new ExecutionContextAccessor(httpContextAccessor);

            var emailsConfiguration = new EmailsConfiguration(_configuration["EmailsConfiguration:FromEmail"]);

            MeetingsStartup.Initialize(
                _configuration[MeetingsConnectionString],
                executionContextAccessor,
                _logger,
                emailsConfiguration,
                null);

            AdministrationStartup.Initialize(
                _configuration[MeetingsConnectionString],
                executionContextAccessor,
                _logger,
                null);

            UserAccessStartup.Initialize(
                _configuration[MeetingsConnectionString],
                executionContextAccessor,
                _logger,
                emailsConfiguration,
                _configuration["Security:TextEncryptionKey"],
                null);

            PaymentsStartup.Initialize(
                _configuration[MeetingsConnectionString],
                executionContextAccessor,
                _logger,
                emailsConfiguration,
                null);
        }