public ActionResult InsertProductReviewsFast(int count, int commitCount)
        {
            var awContext = new AdventureWorks();

              var firstProduct = awContext.Products.Select(p => p.ProductID).First();

              var timer = Stopwatch.StartNew();
              awContext.Configuration.AutoDetectChangesEnabled = false;
              awContext.Configuration.ValidateOnSaveEnabled = false;

              for (var i = 0; i < count; i++)
              {
            awContext.ProductReviews.Add(new ProductReview()
            {
              Comments = "test",
              EmailAddress = "*****@*****.**",
              ProductID = firstProduct,
              ModifiedDate = DateTime.Now,
              Rating = 3,
              ReviewDate = DateTime.Now.AddDays(5),
              ReviewerName = "John Wiegert"
            });

            if (i % commitCount == 0)
            {
              awContext.SaveChanges();
            }
              }

              awContext.SaveChanges();

              timer.Stop();
              var time = timer.Elapsed;

              return View("Index", (object)time.ToString());
        }
        public ActionResult UpdateProductsList()
        {
            var awContext = new AdventureWorks();
              awContext.Configuration.AutoDetectChangesEnabled = true;

              var productFullList = awContext.Products.Take(2).ToList();
              var random = new Random();

              foreach (var product in productFullList)
              {
            product.Weight = random.Next();
              }

              awContext.SaveChanges();

              return Json("Success!", JsonRequestBehavior.AllowGet);
        }
        public ActionResult InsertProductReviews(int count, int productId = 1)
        {
            var awContext = new AdventureWorks();

              var timer = Stopwatch.StartNew();

              for (var i = 0; i < count; i++)
              {
            awContext.ProductReviews.Add(new ProductReview()
            {
              Comments = "test",
              EmailAddress = "*****@*****.**",
              ProductID = productId,
              ModifiedDate = DateTime.Now,
              Rating = 3,
              ReviewDate = DateTime.Now.AddDays(5),
              ReviewerName = "John Wiegert"
            });
              }

              awContext.SaveChanges();

              timer.Stop();
              var time = timer.Elapsed;

              return View("Index", (object)time.ToString());
        }