Beispiel #1
0
        public static void Main(string[] args)
        {
            var host = BuildWebHost(args);

            using (var serviceScope = host.Services.CreateScope())
            {
                var context = serviceScope.ServiceProvider.GetRequiredService <StoreDbContext>();
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();
                context.Account.AddRange(AccountEntity.CreateDumpData());
                context.Product.AddRange(ProductEntity.CreateDumpData());
                context.ProductLikes.AddRange(ProductLikesEntity.CreateDumpData());
                context.SaveChanges();
            }
            host.Run();
        }