Beispiel #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            var diHelper = new DIHelper(services);

            services.AddLogging();
            diHelper.TryAddScoped <ResourceData>();
            diHelper.AddDbContextManagerService <ResourceDbContext>();
            diHelper.AddLoggerService();
            diHelper.TryAddSingleton(Configuration);
        }
Beispiel #2
0
        public static DIHelper AddDbContextManagerService <T>(this DIHelper services) where T : BaseDbContext, new()
        {
            services.TryAddScoped <DbContextManager <T> >();
            services.TryAddScoped <MultiRegionalDbContextManager <T> >();
            services.TryAddScoped <IConfigureOptions <T>, ConfigureDbContext>();
            services.TryAddScoped <IConfigureOptions <MultiRegionalDbContext <T> >, ConfigureMultiRegionalDbContext <T> >();
            //services.TryAddScoped<T>();

            return(services.AddLoggerService());
        }