mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-23 04:23:47 +08:00
performance optimization
This commit is contained in:
@@ -14,24 +14,45 @@ namespace SqlSugar
|
|||||||
#region Queryable
|
#region Queryable
|
||||||
public static ISugarQueryable<T> GetQueryable<T>(ConnectionConfig currentConnectionConfig)
|
public static ISugarQueryable<T> GetQueryable<T>(ConnectionConfig currentConnectionConfig)
|
||||||
{
|
{
|
||||||
string className = "Queryable";
|
if (currentConnectionConfig.DbType == DbType.SqlServer)
|
||||||
className = GetClassName(currentConnectionConfig.DbType, className);
|
{
|
||||||
ISugarQueryable<T> result = CreateInstance<T, ISugarQueryable<T>>(className);
|
return new SqlServerQueryable<T>();
|
||||||
return result;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string className = "Queryable";
|
||||||
|
className = GetClassName(currentConnectionConfig.DbType, className);
|
||||||
|
ISugarQueryable<T> result = CreateInstance<T, ISugarQueryable<T>>(className);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public static ISugarQueryable<T, T2> GetQueryable<T, T2>(ConnectionConfig currentConnectionConfig)
|
public static ISugarQueryable<T, T2> GetQueryable<T, T2>(ConnectionConfig currentConnectionConfig)
|
||||||
{
|
{
|
||||||
string className = "Queryable";
|
if (currentConnectionConfig.DbType == DbType.SqlServer)
|
||||||
className = GetClassName(currentConnectionConfig.DbType, className);
|
{
|
||||||
ISugarQueryable<T, T2> result = CreateInstance<T, T2, ISugarQueryable<T, T2>>(className);
|
return new SqlServerQueryable<T, T2>();
|
||||||
return result;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string className = "Queryable";
|
||||||
|
className = GetClassName(currentConnectionConfig.DbType, className);
|
||||||
|
ISugarQueryable<T, T2> result = CreateInstance<T, T2, ISugarQueryable<T, T2>>(className);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public static ISugarQueryable<T, T2, T3> GetQueryable<T, T2, T3>(ConnectionConfig currentConnectionConfig)
|
public static ISugarQueryable<T, T2, T3> GetQueryable<T, T2, T3>(ConnectionConfig currentConnectionConfig)
|
||||||
{
|
{
|
||||||
string className = "Queryable";
|
if (currentConnectionConfig.DbType == DbType.SqlServer)
|
||||||
className = GetClassName(currentConnectionConfig.DbType, className);
|
{
|
||||||
ISugarQueryable<T, T2, T3> result = CreateInstance<T, T2, T3, ISugarQueryable<T, T2, T3>>(className);
|
return new SqlServerQueryable<T, T2, T3>();
|
||||||
return result;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string className = "Queryable";
|
||||||
|
className = GetClassName(currentConnectionConfig.DbType, className);
|
||||||
|
ISugarQueryable<T, T2, T3> result = CreateInstance<T, T2, T3, ISugarQueryable<T, T2, T3>>(className);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public static ISugarQueryable<T, T2, T3, T4> GetQueryable<T, T2, T3, T4>(ConnectionConfig currentConnectionConfig)
|
public static ISugarQueryable<T, T2, T3, T4> GetQueryable<T, T2, T3, T4>(ConnectionConfig currentConnectionConfig)
|
||||||
{
|
{
|
||||||
@@ -72,8 +93,15 @@ namespace SqlSugar
|
|||||||
|
|
||||||
public static QueryBuilder GetQueryBuilder(ConnectionConfig currentConnectionConfig)
|
public static QueryBuilder GetQueryBuilder(ConnectionConfig currentConnectionConfig)
|
||||||
{
|
{
|
||||||
QueryBuilder result = CreateInstance<QueryBuilder>(GetClassName(currentConnectionConfig.DbType, "QueryBuilder"));
|
if (currentConnectionConfig.DbType == DbType.SqlServer)
|
||||||
return result;
|
{
|
||||||
|
return new SqlServerQueryBuilder();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QueryBuilder result = CreateInstance<QueryBuilder>(GetClassName(currentConnectionConfig.DbType, "QueryBuilder"));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public static InsertBuilder GetInsertBuilder(ConnectionConfig currentConnectionConfig)
|
public static InsertBuilder GetInsertBuilder(ConnectionConfig currentConnectionConfig)
|
||||||
{
|
{
|
||||||
@@ -93,8 +121,15 @@ namespace SqlSugar
|
|||||||
|
|
||||||
public static ILambdaExpressions GetLambdaExpressions(ConnectionConfig currentConnectionConfig)
|
public static ILambdaExpressions GetLambdaExpressions(ConnectionConfig currentConnectionConfig)
|
||||||
{
|
{
|
||||||
ILambdaExpressions result = CreateInstance<ILambdaExpressions>(GetClassName(currentConnectionConfig.DbType, "ExpressionContext"));
|
if (currentConnectionConfig.DbType == DbType.SqlServer)
|
||||||
return result;
|
{
|
||||||
|
return new SqlServerExpressionContext();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ILambdaExpressions result = CreateInstance<ILambdaExpressions>(GetClassName(currentConnectionConfig.DbType, "ExpressionContext"));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ISqlBuilder GetSqlbuilder(ConnectionConfig currentConnectionConfig)
|
public static ISqlBuilder GetSqlbuilder(ConnectionConfig currentConnectionConfig)
|
||||||
@@ -161,15 +196,15 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
private static Restult CreateInstance<T, T2, T3, T4, T5, T6, Restult>(string className)
|
private static Restult CreateInstance<T, T2, T3, T4, T5, T6, Restult>(string className)
|
||||||
{
|
{
|
||||||
return CreateInstance<Restult>(className, typeof(T), typeof(T2), typeof(T3), typeof(T4), typeof(T5),typeof(T6));
|
return CreateInstance<Restult>(className, typeof(T), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6));
|
||||||
}
|
}
|
||||||
private static Restult CreateInstance<T, T2, T3, T4, T5, T6, T7, Restult>(string className)
|
private static Restult CreateInstance<T, T2, T3, T4, T5, T6, T7, Restult>(string className)
|
||||||
{
|
{
|
||||||
return CreateInstance< Restult > (className, typeof(T), typeof(T2), typeof(T3), typeof(T4), typeof(T5),typeof(T6),typeof(T7));
|
return CreateInstance<Restult>(className, typeof(T), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7));
|
||||||
}
|
}
|
||||||
private static Restult CreateInstance<T, T2, T3, T4, T5, T6, T7, T8, Restult>(string className)
|
private static Restult CreateInstance<T, T2, T3, T4, T5, T6, T7, T8, Restult>(string className)
|
||||||
{
|
{
|
||||||
return CreateInstance<Restult>(className, typeof(T), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7),typeof(T8));
|
return CreateInstance<Restult>(className, typeof(T), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8));
|
||||||
}
|
}
|
||||||
private static Restult CreateInstance<Restult>(string className, params Type[] types)
|
private static Restult CreateInstance<Restult>(string className, params Type[] types)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user