Exemple #1
0
        public void Configure(ConfigurationContext context)
        {
            var serviceCollection = new ServiceCollection();

            var ourContext = new Abstractions.Boot.ConfigurationContext
            {
                Configuration     = new ServerConfigWrapper(context.Configuration),
                ConnectionFactory = context.ConnectionFactory,
                ServiceProvider   = GetServiceProvider,
                Services          = serviceCollection
            };
            var ignoredModules = context.Configuration.GetSection("DisabledModules:ReportAnalyzer");

            _reportAnalyzerModuleStarter.Configure(ourContext, new ServerConfigSectionWrapper(ignoredModules));

            RegisterConfigurationStores(ourContext);
            ourContext.Services.AddScoped <IPrincipalAccessor, MessagingPrincipalWrapper>();
            ourContext.Services.AddScoped <IAdoNetUnitOfWork>(x =>
                                                              new AnalysisUnitOfWork(x.GetService <IDbConnection>(), false));
            ourContext.Services.AddScoped(provider =>
            {
                var principal = provider.GetService <IPrincipalAccessor>().Principal
                                ?? CoderrClaims.SystemPrincipal;

                return(context.ConnectionFactory(principal));
            });

            _serviceProvider = serviceCollection.BuildServiceProvider();
        }
Exemple #2
0
 private void RegisterConfigurationStores(Abstractions.Boot.ConfigurationContext context)
 {
     context.Services.AddScoped(typeof(IConfiguration <>), typeof(ConfigWrapper <>));
     context.Services.AddScoped <ConfigurationStore>(x =>
                                                     new DatabaseStore(() => context.ConnectionFactory(CoderrClaims.SystemPrincipal)));
 }