예제 #1
0
        private static TimeSpan SlowDelete()
        {
            using (EntitiesModel context = new EntitiesModel())
            {
                Stopwatch watch = new Stopwatch();

                var customersToRemove = from product in context.Products
                                        where (product.ProductID > 80)
                                        select product;

                watch.Start();
                context.Delete(customersToRemove);
                //context.Delete(context.Products.Where(p => p.ProductID % 7 == 2 && p.ProductID > 80));
                context.SaveChanges();
                watch.Stop();

                return watch.Elapsed;
            }
        }