Esempio n. 1
0
        public void TestInitialize()
        {
            type = typeof(QuantityDbInitializer);
            var options = new DbContextOptionsBuilder <QuantityDbContext>().UseInMemoryDatabase("TestDb").Options;

            db = new QuantityDbContext(options);
            QuantityDbInitializer.Initialize(db);
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            var host = CreateHostBuilder(args).Build();

            using (var scope = host.Services.CreateScope())
            {
                var services   = scope.ServiceProvider;
                var dbQuantity = services.GetRequiredService <QuantityDbContext>();
                QuantityDbInitializer.Initialize(dbQuantity);
            }
            host.Run();
        }
Esempio n. 3
0
        public static void Main(string[] args)
        {
            var host = CreateHostBuilder(args).Build();     //võtan hosti

            using (var scope = host.Services.CreateScope()) //vaatan mis teenused hostis on
            {
                var services   = scope.ServiceProvider;     //loon endale kõik need teenused mida vaja
                var dbQuantity = services.GetRequiredService <QuantityDbContext>();
                QuantityDbInitializer.Initialize(dbQuantity);
            }
            host.Run();
        }