This commit is contained in:
sunkaixuan 2017-04-30 19:45:14 +08:00
parent ec65a93511
commit 4d53cd7622
7 changed files with 61 additions and 16 deletions

View File

@ -72,8 +72,9 @@
<Compile Include="Models\Student.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UnitTest\RenameMapping\MapColumn.cs" />
<Compile Include="UnitTest\RenameMapping\MapTable.cs" />
<Compile Include="UnitTest\Setting\AutoClose.cs" />
<Compile Include="UnitTest\Setting\MapColumn.cs" />
<Compile Include="UnitTest\Setting\MapTable.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

View File

@ -11,6 +11,10 @@ namespace OrmTest.PerformanceTesting
{
public class ChloeORMPerformance: PerformanceBase
{
public ChloeORMPerformance(int eachCount)
{
this.count = eachCount;
}
public void Select()
{
MsSqlContext db = new MsSqlContext(Config.ConnectionString);

View File

@ -10,7 +10,11 @@ namespace OrmTest.PerformanceTesting
{
public class SqlSugarPerformance : PerformanceBase
{
public void Select()
public SqlSugarPerformance(int eachCount)
{
this.count = eachCount;
}
public void Select()
{
SqlSugarClient db = new SqlSugarClient(new SystemTablesConfig()
{

View File

@ -18,20 +18,16 @@ namespace OrmTest
static void Main(string[] args)
{
//Unit Test
int eachCount = 1;
//new Field(eachCount).Init();
//new Where(eachCount).Init();
//new Method(eachCount).Init();
//new JoinQuery(eachCount).Init();
//new SingleQuery(eachCount).Init();
//new SelectQuery(eachCount).Init();
new MapTable().Init();
//new Field(1).Init();
//new Where(1).Init();
//new Method(1).Init();
//new JoinQuery(1).Init();
//new SingleQuery(1).Init();
//new SelectQuery(1).Init();
//new AutoClose(200).Init();
//Performance Test
for (int i = 0; i < 100; i++)
{
// new SqlSugarPerformance().Select();
}
//new SqlSugarPerformance(100).Select();
}
}
}

View File

@ -0,0 +1,36 @@
using OrmTest.Models;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest.UnitTest
{
public class AutoClose : ExpTestBase
{
public AutoClose(int eachCount)
{
this.Count = eachCount;
}
public void Init()
{
//IsAutoCloseConnection
for (int i = 0; i < this.Count; i++)
{
var db = GetInstance();
var x = db.Queryable<Student>().ToList();
}
}
public SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new SystemTablesConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
return db;
}
}
}

View File

@ -12,12 +12,16 @@ namespace OrmTest.UnitTest
{
public void Init()
{
var db = GetInstance();
//IsAutoCloseConnection
for (int i = 0; i < 200; i++)
{
var db = GetInstance();
var x = db.Queryable<Student>().ToList();
}
}
public SqlSugarClient GetInstance()
{