Update Demo

This commit is contained in:
sunkaixuan 2017-09-29 10:56:37 +08:00
parent 070315c1e5
commit 8df102e19a
4 changed files with 12 additions and 7 deletions

View File

@ -9,7 +9,7 @@ namespace PerformanceTest
public class Config
{
public static string connectionString = "server=.;uid=sa;pwd=sasa;database=SqlSugarTest";
public static ConnectionConfig SugarConfig =new ConnectionConfig() { InitKeyType = InitKeyType.SystemTable, ConnectionString = Config.connectionString, DbType = DbType.SqlServer };
public static ConnectionConfig SugarConfig =new ConnectionConfig() { IsAutoCloseConnection=true,InitKeyType = InitKeyType.SystemTable, ConnectionString = Config.connectionString, DbType = DbType.SqlServer };
public static SqlSugarClient GetSugarConn()
{
return new SqlSugarClient(SugarConfig);

View File

@ -16,7 +16,7 @@ namespace PerformanceTest
static void Main(string[] args)
{
var type = DemoType.GetSql;
var ormType = OrmType.SqlSugar;
var ormType = OrmType.Dapper;
switch (type)
{
case DemoType.GetAll:

View File

@ -44,10 +44,8 @@ namespace PerformanceTest.TestItems
PerHelper.Execute(eachCount, "SqlSugar", () =>
{
using (SqlSugarClient conn = Config.GetSugarConn())
{
SqlSugarClient conn = Config.GetSugarConn();
var list2 = conn.Ado.SqlQuery<Test>("select top 20 * from Test"); ;
}
});
}

View File

@ -245,10 +245,17 @@ namespace SqlSugar
}
public static IAdo GetAdo(ConnectionConfig currentConnectionConfig)
{
if (currentConnectionConfig.DbType == DbType.SqlServer)
{
return new SqlServerProvider();
}
else
{
IAdo result = CreateInstance<IAdo>(GetClassName(currentConnectionConfig.DbType.ToString(), "Provider"));
return result;
}
}
private static string GetClassName(string type, string name)
{