diff --git a/Src/Asp.Net/PerformanceTest/TestItems/TestGetAll.cs b/Src/Asp.Net/PerformanceTest/TestItems/TestGetAll.cs index f5abe2921..913d89fac 100644 --- a/Src/Asp.Net/PerformanceTest/TestItems/TestGetAll.cs +++ b/Src/Asp.Net/PerformanceTest/TestItems/TestGetAll.cs @@ -11,25 +11,26 @@ namespace PerformanceTest.TestItems { public class TestGetAll { - public void Init() + public void Init(OrmType type) { Console.WriteLine("测试一次读取100万条数据的速度"); var eachCount = 1; - Console.WriteLine("开启预热"); - Dapper(1); - SqlSugar(1); - Console.WriteLine("预热完毕"); - for (int i = 0; i < 10; i++) { - //dapper - Dapper(eachCount); - - //sqlSugar - SqlSugar(eachCount); + switch (type) + { + case OrmType.SqlSugar: + SqlSugar(eachCount); + break; + case OrmType.Dapper: + Dapper(eachCount); + break; + default: + break; + } + } - } private static void SqlSugar(int eachCount) diff --git a/Src/Asp.Net/PerformanceTest/TestItems/TestGetById.cs b/Src/Asp.Net/PerformanceTest/TestItems/TestGetById.cs index 46aeb1758..23dca6ed6 100644 --- a/Src/Asp.Net/PerformanceTest/TestItems/TestGetById.cs +++ b/Src/Asp.Net/PerformanceTest/TestItems/TestGetById.cs @@ -12,25 +12,25 @@ namespace PerformanceTest.TestItems public class TestGetById { - public void Init() + public void Init(OrmType type) { Console.WriteLine("测试一次读取1条数据的速度"); var eachCount = 1000; - Console.WriteLine("开启预热"); - Dapper(1); - SqlSugar(1); - Console.WriteLine("预热完毕"); - for (int i = 0; i < 10; i++) { - //dapper - Dapper(eachCount); - - //sqlSugar - SqlSugar(eachCount); + switch (type) + { + case OrmType.SqlSugar: + SqlSugar(eachCount); + break; + case OrmType.Dapper: + Dapper(eachCount); + break; + default: + break; + } } - } private static void SqlSugar(int eachCount) diff --git a/Src/Asp.Net/PerformanceTest/TestItems/TestSql.cs b/Src/Asp.Net/PerformanceTest/TestItems/TestSql.cs index 80339301a..324a020db 100644 --- a/Src/Asp.Net/PerformanceTest/TestItems/TestSql.cs +++ b/Src/Asp.Net/PerformanceTest/TestItems/TestSql.cs @@ -21,11 +21,9 @@ namespace PerformanceTest.TestItems switch (type) { case OrmType.SqlSugar: - //sqlSugar SqlSugar(eachCount); break; case OrmType.Dapper: - //dapper Dapper(eachCount); break; }