Example #1
0
        private static void ResetAndWarmup()
        {
            TestEf6.ResetAndWarmUp();

            using (var db = new EFCore3.EfStructures.AW2016Context())
            {
                //db.Database.ExecuteSqlCommand(@"DELETE FROM Production.ProductCategory WHERE Name LIKE 'Test %'");
                db.Customer.FirstOrDefault();
            }
        }
Example #2
0
 private static void RunToListTestUntracked()
 {
     Console.WriteLine("Query 19K ToList UnTracked");
     RunTest(
         ef6Test: TestEf6.GetAllCustomers,
         ef7Test: () =>
     {
         using (var db = new EFCore3.EfStructures.AW2016Context())
         {
             var foo = db.Customer.AsNoTracking().ToList();
         }
     });
 }
Example #3
0
 //private static void RunToListTestQueryType()
 //{
 //    Console.WriteLine("Query 19K ToList Query Type");
 //    RunTest(
 //        ef6Test: TestEf6.GetAllCustomers,
 //        ef7Test: () =>
 //        {
 //            using (var db = new EFCore3.EfStructures.AW2016Context())
 //            {
 //                db.CustomersQuery.ToList();
 //            }
 //        });
 //}
 //private static void RunToListTestCoreVsQueryType()
 //{
 //    Console.WriteLine("Query 19K ToList UnTracked vs QueryType");
 //    RunTest(
 //        ef6Test: () =>
 //        {
 //            using (var db = new EFCore3.EfStructures.AW2016Context())
 //            {
 //                var foo = db.Customer.AsNoTracking().ToList();
 //            }
 //        },
 //        ef7Test: () =>
 //        {
 //            using (var db = new EFCore3.EfStructures.AW2016Context())
 //            {
 //                db.CustomersQuery.ToList();
 //            }
 //        },
 //        firstLabel: "-  Untracked",
 //        secondLabel: "- QueryType");
 //}
 //private static void RunToListTestCoreVsQueryTypeAsView()
 //{
 //    Console.WriteLine("Query 19K ToList Query Type vs QueryType From View");
 //    RunTest(
 //        ef6Test: () =>
 //        {
 //            using (var db = new EFCore3.EfStructures.AW2016Context())
 //            {
 //                db.CustomersQuery.ToList();
 //            }
 //        },
 //        ef7Test: () =>
 //        {
 //            using (var db = new EFCore3.EfStructures.AW2016Context())
 //            {
 //                db.CustomersView.ToList();
 //            }
 //        },
 //        firstLabel: "-  QueryType",
 //        secondLabel: "- QueryTypeAsView");
 //}
 private static void RunComplexQueryTest()
 {
     Console.WriteLine("Query Complex");
     RunTest(
         ef6Test: TestEf6.RunComplexQuery,
         ef7Test: () =>
     {
         using (var db = new EFCore3.EfStructures.AW2016Context())
         {
             EFCore3.TestEfCore3.RunComplexQuery();
             //var el = Repo.CompiledQuery(db).ToList();
             //var el = Repo.GetComplexDataQueryType(db).ToList();
         }
     });
 }
Example #4
0
 //private static void RunComplexQueryTestCorevsCore()
 //{
 //    Console.WriteLine("Query Complex Core vs Core");
 //    RunTest(
 //        ef6Test: () =>
 //        {
 //            using (var db = new EFCore3.EfStructures.AW2016Context())
 //            {
 //                var el = PerformanceEfCore.EfStructures.Repo.GetComplexData(db);
 //            }
 //        },
 //        ef7Test: () =>
 //        {
 //            using (var db = new EFCore3.EfStructures.AW2016Context())
 //            {
 //                //var el = Repo.CompiledQuery(db).ToList();
 //                var el = PerformanceEfCore.EfStructures.Repo.GetComplexDataQueryType(db).ToList();
 //            }
 //        },
 //        firstLabel:"-  FromSQL",
 //        secondLabel:"- Compiled");
 //}
 private static void RunAddAndSaveChangesTest()
 {
     Console.WriteLine("Add 1K & SaveChanges");
     RunTest(
         TestEf6.AddRecordsAndSave,
         () =>
     {
         using (var db = new EFCore3.EfStructures.AW2016Context())
         {
             for (int i = 0; i < 1000; i++)
             {
                 db.ProductCategory.Add(new EFCore3.Entities.ProductCategory {
                     Name = $"Test {Guid.NewGuid()}"
                 });
             }
             db.SaveChanges();
         }
     });
 }