mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-30 04:45:54 +08:00
-
This commit is contained in:
parent
ec65a93511
commit
4d53cd7622
@ -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" />
|
||||
|
@ -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);
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
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()
|
||||
{
|
||||
var db = GetInstance();
|
||||
|
||||
//IsAutoCloseConnection
|
||||
for (int i = 0; i < 200; i++)
|
||||
{
|
||||
var db = GetInstance();
|
||||
var x = db.Queryable<Student>().ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
public SqlSugarClient GetInstance()
|
||||
{
|
Loading…
Reference in New Issue
Block a user