Beispiel #1
0
        public void SeedProducts(ProductsWebApiContext context)
        {
            context.Database.EnsureCreated();

            if (context.Products.Any())
            {
                return;
            }

            context.Products.AddRange(GetProducts());
            context.SaveChanges();
        }
Beispiel #2
0
        public static void Initialize(ProductsWebApiContext context)
        {
            var seeder = new ProductsWebApiInitializer();

            seeder.SeedProducts(context);
        }