コード例 #1
0
        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);
        }
コード例 #2
0
 public BookRepository(TheosBookStoreStockDbContext dbContext, IMapper mapper, ILogger <BookRepository> logger)
     : base(dbContext, mapper)
 {
     _logger = logger;
 }