Esempio n. 1
0
        private static void BulkInsert(NorthwindModel context)
        {
            List<Product> products = new List<Product>(50000);

            for (int i = 0; i < 30000; i++)
            {
                Product product = new Product() { ProductName = "Lexus" + i, SupplierID = 5, CategoryID = 5, UnitPrice = 1000m, QuantityPerUnit = "1 piece" };
                products.Add(product);
            }

            context.Add(products);

            context.SaveChanges();
        }
Esempio n. 2
0
 private static void SlowDelete(NorthwindModel context)
 {
     context.Delete(context.Products.Where(p => p.ProductID % 7 == 2));
     context.SaveChanges();
 }