mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-08 10:24:55 +08:00
Catalog arrangement
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using SyntacticSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrmTest.PerformanceTesting
|
||||
{
|
||||
public class PerformanceBase
|
||||
{
|
||||
public int count = 100;
|
||||
public void Execute(string title, Action fun)
|
||||
{
|
||||
PerformanceTest ptef = new PerformanceTest();
|
||||
ptef.SetCount(count);//执行count次
|
||||
ptef.Execute(
|
||||
i =>
|
||||
{
|
||||
fun();
|
||||
|
||||
},
|
||||
res =>
|
||||
{
|
||||
Console.WriteLine(string.Format("Execute {0} time,{1}{2}", count, title, res));
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
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
|
||||
{
|
||||
public SqlSugarPerformance(int eachCount)
|
||||
{
|
||||
this.count = eachCount;
|
||||
}
|
||||
public void Select()
|
||||
{
|
||||
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
||||
{
|
||||
ConnectionString = Config.ConnectionString,
|
||||
DbType = DbType.SqlServer,
|
||||
IsAutoCloseConnection = false
|
||||
});
|
||||
db.IgnoreColumns.Add("TestId", "Student");
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user