public virtual void InitializeContext()
 {
     _context = AdventureWorksFixture.CreateContext();
     _query   = Filter
         ? _context.Store.Where(s => s.SalesPerson.Bonus > 3000)
         : _context.Store.Where(s => s.SalesPerson.Bonus >= 0);
 }
Exemple #2
0
            public void InitializeAndSaveChanges_AdventureWorks(IMetricCollector collector, int count)
            {
                using (collector.StartCollection())
                {
                    for (var i = 0; i < count; i++)
                    {
                        using (var context = AdventureWorksFixture.CreateContext())
                        {
                            context.Currency.Add(new Currency
                            {
                                CurrencyCode = "TMP",
                                Name         = "Temporary"
                            });

                            using (context.Database.BeginTransaction())
                            {
                                context.SaveChanges();

                                // Don't mesure transaction rollback
                                collector.StopCollection();
                            }
                            collector.StartCollection();
                        }
                    }
                }
            }
 public void InitializeAndQuery_AdventureWorks(int count)
 {
     for (var i = 0; i < count; i++)
     {
         using (var context = AdventureWorksFixture.CreateContext())
         {
             context.Department.First();
         }
     }
 }
 public void CreateAndDisposeUnusedContext(int count)
 {
     for (var i = 0; i < count; i++)
     {
         // ReSharper disable once UnusedVariable
         using (var context = AdventureWorksFixture.CreateContext())
         {
         }
     }
 }
 public void InitializeAndQuery_AdventureWorks(int count)
 {
     for (var i = 0; i < count; i++)
     {
         using (var context = AdventureWorksFixture.CreateContext())
         {
             // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
             context.Department.First();
         }
     }
 }
Exemple #6
0
 public void CreateAndDisposeUnusedContext(IMetricCollector collector, int count)
 {
     using (collector.StartCollection())
     {
         for (var i = 0; i < count; i++)
         {
             using (var context = AdventureWorksFixture.CreateContext())
             {
             }
         }
     }
 }
Exemple #7
0
 public void InitializeAndQuery_AdventureWorks(IMetricCollector collector, int count)
 {
     using (collector.StartCollection())
     {
         for (var i = 0; i < count; i++)
         {
             using (var context = AdventureWorksFixture.CreateContext())
             {
                 context.Department.First();
             }
         }
     }
 }
            public virtual void InitializeAndSaveChanges_AdventureWorks(int count)
            {
                for (var i = 0; i < count; i++)
                {
                    using (var context = AdventureWorksFixture.CreateContext())
                    {
                        context.Currency.Add(
                            new Currency {
                            CurrencyCode = "TMP", Name = "Temporary"
                        });

                        using (context.Database.BeginTransaction())
                        {
                            context.SaveChanges();

                            // TODO: Don't measure transaction rollback
                        }
                    }
                }
            }
 protected override AdventureWorksContextBase CreateContext()
 {
     return(AdventureWorksFixture.CreateContext());
 }