mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
-
This commit is contained in:
parent
ec65a93511
commit
4d53cd7622
@ -72,8 +72,9 @@
|
|||||||
<Compile Include="Models\Student.cs" />
|
<Compile Include="Models\Student.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="UnitTest\RenameMapping\MapColumn.cs" />
|
<Compile Include="UnitTest\Setting\AutoClose.cs" />
|
||||||
<Compile Include="UnitTest\RenameMapping\MapTable.cs" />
|
<Compile Include="UnitTest\Setting\MapColumn.cs" />
|
||||||
|
<Compile Include="UnitTest\Setting\MapTable.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
|
@ -11,6 +11,10 @@ namespace OrmTest.PerformanceTesting
|
|||||||
{
|
{
|
||||||
public class ChloeORMPerformance: PerformanceBase
|
public class ChloeORMPerformance: PerformanceBase
|
||||||
{
|
{
|
||||||
|
public ChloeORMPerformance(int eachCount)
|
||||||
|
{
|
||||||
|
this.count = eachCount;
|
||||||
|
}
|
||||||
public void Select()
|
public void Select()
|
||||||
{
|
{
|
||||||
MsSqlContext db = new MsSqlContext(Config.ConnectionString);
|
MsSqlContext db = new MsSqlContext(Config.ConnectionString);
|
||||||
|
@ -10,7 +10,11 @@ namespace OrmTest.PerformanceTesting
|
|||||||
{
|
{
|
||||||
public class SqlSugarPerformance : PerformanceBase
|
public class SqlSugarPerformance : PerformanceBase
|
||||||
{
|
{
|
||||||
public void Select()
|
public SqlSugarPerformance(int eachCount)
|
||||||
|
{
|
||||||
|
this.count = eachCount;
|
||||||
|
}
|
||||||
|
public void Select()
|
||||||
{
|
{
|
||||||
SqlSugarClient db = new SqlSugarClient(new SystemTablesConfig()
|
SqlSugarClient db = new SqlSugarClient(new SystemTablesConfig()
|
||||||
{
|
{
|
||||||
|
@ -18,20 +18,16 @@ namespace OrmTest
|
|||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
//Unit Test
|
//Unit Test
|
||||||
int eachCount = 1;
|
//new Field(1).Init();
|
||||||
//new Field(eachCount).Init();
|
//new Where(1).Init();
|
||||||
//new Where(eachCount).Init();
|
//new Method(1).Init();
|
||||||
//new Method(eachCount).Init();
|
//new JoinQuery(1).Init();
|
||||||
//new JoinQuery(eachCount).Init();
|
//new SingleQuery(1).Init();
|
||||||
//new SingleQuery(eachCount).Init();
|
//new SelectQuery(1).Init();
|
||||||
//new SelectQuery(eachCount).Init();
|
//new AutoClose(200).Init();
|
||||||
new MapTable().Init();
|
|
||||||
|
|
||||||
//Performance Test
|
//Performance Test
|
||||||
for (int i = 0; i < 100; i++)
|
//new SqlSugarPerformance(100).Select();
|
||||||
{
|
|
||||||
// new SqlSugarPerformance().Select();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
36
OrmTest/UnitTest/Setting/AutoClose.cs
Normal file
36
OrmTest/UnitTest/Setting/AutoClose.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -12,12 +12,16 @@ namespace OrmTest.UnitTest
|
|||||||
{
|
{
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
var db = GetInstance();
|
|
||||||
|
//IsAutoCloseConnection
|
||||||
for (int i = 0; i < 200; i++)
|
for (int i = 0; i < 200; i++)
|
||||||
{
|
{
|
||||||
|
var db = GetInstance();
|
||||||
var x = db.Queryable<Student>().ToList();
|
var x = db.Queryable<Student>().ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public SqlSugarClient GetInstance()
|
public SqlSugarClient GetInstance()
|
||||||
{
|
{
|
Loading…
Reference in New Issue
Block a user