mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-15 23:13:42 +08:00
-
This commit is contained in:
parent
0227ce8a56
commit
6a6c0c2aec
43
OrmTest/ExpressionTest/Single.cs
Normal file
43
OrmTest/ExpressionTest/Single.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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" />
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user