Browse Source

Update Demo

pull/12/MERGE
sunkaixuan 7 years ago
parent
commit
8df102e19a
  1. 2
      Src/Asp.Net/PerformanceTest/Config.cs
  2. 2
      Src/Asp.Net/PerformanceTest/Program.cs
  3. 4
      Src/Asp.Net/PerformanceTest/TestItems/TestGetSql.cs
  4. 11
      Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs

2
Src/Asp.Net/PerformanceTest/Config.cs

@ -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);

2
Src/Asp.Net/PerformanceTest/Program.cs

@ -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:

4
Src/Asp.Net/PerformanceTest/TestItems/TestGetSql.cs

@ -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"); ;
}
});
}

11
Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs

@ -246,8 +246,15 @@ namespace SqlSugar
public static IAdo GetAdo(ConnectionConfig currentConnectionConfig)
{
IAdo result = CreateInstance<IAdo>(GetClassName(currentConnectionConfig.DbType.ToString(), "Provider"));
return result;
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)

Loading…
Cancel
Save