using back.context; using back.Options; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Options; namespace back.ServicesExtensions; public static partial class ServicesExtensions { private static IServiceCollection AddDatabaseContexts(this IServiceCollection services) { services .AddContext() .AddContext() .AddContext() .AddContext() .AddContext() .AddContext() ; return services; } private static IServiceCollection AddContext(this IServiceCollection services) where T : DbContext { var config = services .BuildServiceProvider() .GetRequiredService>() .Get(DatabaseConfig.DataStorage); services.AddDbContext(options => { options.UseDatabaseConfig(config); }); return services; } }