SqlSugar/Src/Asp.Net/SqlServerTest/PerformanceTesting/SqlSugarPerformance.cs

35 lines
1.0 KiB
C#
Raw Normal View History

2017-04-24 01:31:37 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;
using OrmTest.Models;
namespace OrmTest.PerformanceTesting
{
public class SqlSugarPerformance : PerformanceBase
{
2017-04-30 19:45:14 +08:00
public SqlSugarPerformance(int eachCount)
{
this.count = eachCount;
}
public void Select()
2017-04-24 01:31:37 +08:00
{
2017-05-28 10:01:58 +08:00
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
2017-04-24 01:31:37 +08:00
{
ConnectionString = Config.ConnectionString,
DbType = DbType.SqlServer,
IsAutoCloseConnection = false
});
2017-05-01 14:23:13 +08:00
db.IgnoreColumns.Add("TestId", "Student");
2017-04-24 01:31:37 +08:00
db.Queryable<Student>().Select(it => new ViewModelStudent2 { Name = it.Name, Student = it }).ToList();
base.Execute("sqlsuagr", () =>
{
var test = db.Queryable<Student>().Select(it => new ViewModelStudent2 { Name = it.Name, Student = it }).ToList();
});
db.Close();
}
}
}