public static IHost InitializeDataBase(this IHost host) { var serviceScopeFactory = host.Services; using var scope = serviceScopeFactory.CreateScope(); var services = scope.ServiceProvider; TheosBookStoreStockDbContext stockDB = services .GetRequiredService <TheosBookStoreStockDbContext>(); stockDB.Database.Migrate(); TheosBookStoreAuthDbContext authDB = services .GetRequiredService <TheosBookStoreAuthDbContext>(); authDB.Database.Migrate(); return(host); }
public BookRepository(TheosBookStoreStockDbContext dbContext, IMapper mapper, ILogger <BookRepository> logger) : base(dbContext, mapper) { _logger = logger; }