mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-22 20:13:41 +08:00
Code optimization
This commit is contained in:
@@ -777,37 +777,37 @@ namespace SqlSugar
|
||||
result = GetData<T>(typeof(T), dataReader);
|
||||
}
|
||||
List<T2> result2 = null;
|
||||
if (dataReader.NextResult())
|
||||
if (NextResult(dataReader))
|
||||
{
|
||||
this.Context.InitMappingInfo<T2>();
|
||||
result2 = GetData<T2>(typeof(T2), dataReader);
|
||||
}
|
||||
List<T3> result3 = null;
|
||||
if (dataReader.NextResult())
|
||||
if (NextResult(dataReader))
|
||||
{
|
||||
this.Context.InitMappingInfo<T3>();
|
||||
result3 = GetData<T3>(typeof(T3), dataReader);
|
||||
}
|
||||
List<T4> result4 = null;
|
||||
if (dataReader.NextResult())
|
||||
if (NextResult(dataReader))
|
||||
{
|
||||
this.Context.InitMappingInfo<T4>();
|
||||
result4 = GetData<T4>(typeof(T4), dataReader);
|
||||
}
|
||||
List<T5> result5 = null;
|
||||
if (dataReader.NextResult())
|
||||
if (NextResult(dataReader))
|
||||
{
|
||||
this.Context.InitMappingInfo<T5>();
|
||||
result5 = GetData<T5>(typeof(T5), dataReader);
|
||||
}
|
||||
List<T6> result6 = null;
|
||||
if (dataReader.NextResult())
|
||||
if (NextResult(dataReader))
|
||||
{
|
||||
this.Context.InitMappingInfo<T6>();
|
||||
result6 = GetData<T6>(typeof(T6), dataReader);
|
||||
}
|
||||
List<T7> result7 = null;
|
||||
if (dataReader.NextResult())
|
||||
if (NextResult(dataReader))
|
||||
{
|
||||
this.Context.InitMappingInfo<T7>();
|
||||
result7 = GetData<T7>(typeof(T7), dataReader);
|
||||
@@ -828,7 +828,6 @@ namespace SqlSugar
|
||||
return Tuple.Create<List<T>, List<T2>, List<T3>, List<T4>, List<T5>, List<T6>, List<T7>>(result, result2, result3, result4, result5, result6, result7);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual Task<List<T>> SqlQueryAsync<T>(string sql, object parameters = null)
|
||||
{
|
||||
var sugarParameters = this.GetParameters(parameters);
|
||||
@@ -892,37 +891,37 @@ namespace SqlSugar
|
||||
result =await GetDataAsync<T>(typeof(T), dataReader);
|
||||
}
|
||||
List<T2> result2 = null;
|
||||
if (dataReader.NextResult())
|
||||
if (NextResult(dataReader))
|
||||
{
|
||||
this.Context.InitMappingInfo<T2>();
|
||||
result2 = await GetDataAsync<T2>(typeof(T2), dataReader);
|
||||
}
|
||||
List<T3> result3 = null;
|
||||
if (dataReader.NextResult())
|
||||
if (NextResult(dataReader))
|
||||
{
|
||||
this.Context.InitMappingInfo<T3>();
|
||||
result3 = await GetDataAsync<T3>(typeof(T3), dataReader);
|
||||
}
|
||||
List<T4> result4 = null;
|
||||
if (dataReader.NextResult())
|
||||
if (NextResult(dataReader))
|
||||
{
|
||||
this.Context.InitMappingInfo<T4>();
|
||||
result4 = await GetDataAsync<T4>(typeof(T4), dataReader);
|
||||
}
|
||||
List<T5> result5 = null;
|
||||
if (dataReader.NextResult())
|
||||
if (NextResult(dataReader))
|
||||
{
|
||||
this.Context.InitMappingInfo<T5>();
|
||||
result5 = await GetDataAsync<T5>(typeof(T5), dataReader);
|
||||
}
|
||||
List<T6> result6 = null;
|
||||
if (dataReader.NextResult())
|
||||
if (NextResult(dataReader))
|
||||
{
|
||||
this.Context.InitMappingInfo<T6>();
|
||||
result6 = await GetDataAsync<T6>(typeof(T6), dataReader);
|
||||
}
|
||||
List<T7> result7 = null;
|
||||
if (dataReader.NextResult())
|
||||
if (NextResult(dataReader))
|
||||
{
|
||||
this.Context.InitMappingInfo<T7>();
|
||||
result7 = await GetDataAsync<T7>(typeof(T7), dataReader);
|
||||
@@ -1157,13 +1156,25 @@ namespace SqlSugar
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// dataReader.NextResult();
|
||||
// NextResult(dataReader);
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// // Check.Exception(true, ErrorMessage.GetThrowMessage("Please reduce the number of T. Save Queue Changes queries don't have so many results", "请减少T的数量,SaveQueueChanges 查询没有这么多结果"));
|
||||
// }
|
||||
//}
|
||||
private static bool NextResult(IDataReader dataReader)
|
||||
{
|
||||
try
|
||||
{
|
||||
return dataReader.NextResult();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteProcessingSQL(ref string sql, SugarParameter[] parameters)
|
||||
{
|
||||
var result = this.ProcessingEventStartingSQL(sql, parameters);
|
||||
|
Reference in New Issue
Block a user