public void TestInitialize() { type = typeof(AirFreightDbInitializer); var options = new DbContextOptionsBuilder <AirFreightDbContext>() .Options; db = new AirFreightDbContext(options); AirFreightDbInitializer.Initialize(db); }
public static void Main(string[] args) { var host = CreateHostBuilder(args).Build(); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; var dbRoadFreights = services.GetRequiredService <RoadFreightDbContext>(); RoadFreightDbInitializer.Initialize(dbRoadFreights); var dbSeaFreights = services.GetRequiredService <SeaFreightDbContext>(); SeaFreightDbInitializer.Initialize(dbSeaFreights); var dbAirFreights = services.GetRequiredService <AirFreightDbContext>(); AirFreightDbInitializer.Initialize(dbAirFreights); var dbOrders = services.GetRequiredService <OrderDbContext>(); OrderDbInitializer.Initialize(dbOrders); } host.Run(); }