This commit is contained in:
sunkaixuan 2017-09-21 14:38:40 +08:00
parent 05819eb304
commit 3f96bf2048
3 changed files with 25 additions and 26 deletions

View File

@ -11,26 +11,27 @@ namespace PerformanceTest.TestItems
{ {
public class TestGetAll public class TestGetAll
{ {
public void Init() public void Init(OrmType type)
{ {
Console.WriteLine("测试一次读取100万条数据的速度"); Console.WriteLine("测试一次读取100万条数据的速度");
var eachCount = 1; var eachCount = 1;
Console.WriteLine("开启预热");
Dapper(1);
SqlSugar(1);
Console.WriteLine("预热完毕");
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
//dapper switch (type)
Dapper(eachCount); {
case OrmType.SqlSugar:
//sqlSugar
SqlSugar(eachCount); SqlSugar(eachCount);
break;
case OrmType.Dapper:
Dapper(eachCount);
break;
default:
break;
} }
} }
}
private static void SqlSugar(int eachCount) private static void SqlSugar(int eachCount)
{ {

View File

@ -12,25 +12,25 @@ namespace PerformanceTest.TestItems
public class TestGetById public class TestGetById
{ {
public void Init() public void Init(OrmType type)
{ {
Console.WriteLine("测试一次读取1条数据的速度"); Console.WriteLine("测试一次读取1条数据的速度");
var eachCount = 1000; var eachCount = 1000;
Console.WriteLine("开启预热");
Dapper(1);
SqlSugar(1);
Console.WriteLine("预热完毕");
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
//dapper switch (type)
Dapper(eachCount); {
case OrmType.SqlSugar:
//sqlSugar
SqlSugar(eachCount); SqlSugar(eachCount);
break;
case OrmType.Dapper:
Dapper(eachCount);
break;
default:
break;
}
} }
} }
private static void SqlSugar(int eachCount) private static void SqlSugar(int eachCount)

View File

@ -21,11 +21,9 @@ namespace PerformanceTest.TestItems
switch (type) switch (type)
{ {
case OrmType.SqlSugar: case OrmType.SqlSugar:
//sqlSugar
SqlSugar(eachCount); SqlSugar(eachCount);
break; break;
case OrmType.Dapper: case OrmType.Dapper:
//dapper
Dapper(eachCount); Dapper(eachCount);
break; break;
} }