mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
-
This commit is contained in:
parent
c34232ab43
commit
9524dbce95
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -8,5 +9,9 @@ namespace PerformanceTest
|
||||
public class Config
|
||||
{
|
||||
public static string connectionString = "server=.;uid=sa;pwd=sasa;database=SqlSugarTest";
|
||||
public static SqlSugarClient GetSugarConn()
|
||||
{
|
||||
return new SqlSugarClient(new ConnectionConfig() { InitKeyType = InitKeyType.SystemTable, ConnectionString = Config.connectionString, DbType = DbType.SqlServer });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,13 +40,14 @@ namespace PerformanceTest.TestItems
|
||||
|
||||
PerHelper.Execute(eachCount, "SqlSugar", () =>
|
||||
{
|
||||
using (SqlSugarClient conn = new SqlSugarClient(new ConnectionConfig() { InitKeyType=InitKeyType.SystemTable, ConnectionString= Config.connectionString, DbType=DbType.SqlServer }))
|
||||
using (SqlSugarClient conn = Config.GetSugarConn())
|
||||
{
|
||||
var list2 = conn.Queryable<Test>().ToList();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private static void Dapper(int eachCount)
|
||||
{
|
||||
GC.Collect();//回收资源
|
||||
|
@ -40,7 +40,7 @@ namespace PerformanceTest.TestItems
|
||||
|
||||
PerHelper.Execute(eachCount, "SqlSugar", () =>
|
||||
{
|
||||
using (SqlSugarClient conn = new SqlSugarClient(new ConnectionConfig() { InitKeyType = InitKeyType.SystemTable, ConnectionString = Config.connectionString, DbType = DbType.SqlServer }))
|
||||
using (SqlSugarClient conn = Config.GetSugarConn())
|
||||
{
|
||||
var list2 = conn.Queryable<Test>().InSingle(1);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ namespace PerformanceTest.TestItems
|
||||
|
||||
PerHelper.Execute(eachCount, "SqlSugar", () =>
|
||||
{
|
||||
using (SqlSugarClient conn = new SqlSugarClient(new ConnectionConfig() { InitKeyType = InitKeyType.SystemTable, ConnectionString = Config.connectionString, DbType = DbType.SqlServer }))
|
||||
using (SqlSugarClient conn = Config.GetSugarConn())
|
||||
{
|
||||
var list2 = conn.Ado.SqlQuery<Test>("select top 10 * from Test"); ;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user