Exemplo n.º 1
0
        public void SeedProducts(ProductsWebApiContext context)
        {
            context.Database.EnsureCreated();

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

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

            seeder.SeedProducts(context);
        }