public static void Seed() { var context = new ETicaretContext(); //Bekleyen migration yoksa test belleğini databaseye yükle if (context.Database.GetPendingMigrations().Count() == 0) { //Database boşsa eklesin if (context.Categories.Count() == 0) { context.Categories.AddRange(Categories); } if (context.Products.Count() == 0) { context.Products.AddRange(Products); context.AddRange(ProductCategory); } context.SaveChanges(); } }