This commit is contained in:
sunkaixuan 2017-03-04 01:22:06 +08:00
parent 0227ce8a56
commit 6a6c0c2aec
3 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;
using System.Linq.Expressions;
using OrmTest.Models;
namespace OrmTest.ExpressionTest
{
public class Single : ExpTestBase
{
private Single() { }
public Single(int eachCount)
{
this.Count = eachCount;
}
internal void Init()
{
base.Begin();
for (int i = 0; i < base.Count; i++)
{
Q2();
}
base.End("Method Test");
}
public void Q2()
{
using (var db = GetInstance())
{
var list = db.Queryable<Student>().Where(st => st.Id > 0).ToList();
}
}
public SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new SystemTablesConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer });
return db;
}
}
}

View File

@ -49,6 +49,7 @@
<Compile Include="ExpressionTest\Join.cs" />
<Compile Include="ExpressionTest\Method.cs" />
<Compile Include="ExpressionTest\Select.cs" />
<Compile Include="ExpressionTest\Single.cs" />
<Compile Include="ExpressionTest\Where.cs" />
<Compile Include="Models\School.cs" />
<Compile Include="Models\Student.cs" />

View File

@ -23,6 +23,7 @@ namespace OrmTest
new OrmTest.ExpressionTest.Where(eachCount).Init();
new OrmTest.ExpressionTest.Method(eachCount).Init();
new OrmTest.ExpressionTest.Join(eachCount).Init();
new OrmTest.ExpressionTest.Single(eachCount).Init();
}
}
}