2017-03-04 01:22:06 +08:00
|
|
|
|
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;
|
2017-03-04 15:07:58 +08:00
|
|
|
|
namespace OrmTest.UnitTest
|
2017-03-04 01:22:06 +08:00
|
|
|
|
{
|
2017-03-04 15:07:58 +08:00
|
|
|
|
public class SingleQuery : ExpTestBase
|
2017-03-04 01:22:06 +08:00
|
|
|
|
{
|
2017-03-04 15:07:58 +08:00
|
|
|
|
private SingleQuery() { }
|
|
|
|
|
public SingleQuery(int eachCount)
|
2017-03-04 01:22:06 +08:00
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|