|
|
@ -803,7 +803,6 @@ namespace SqlSugar |
|
|
|
return Tuple.Create<List<T>, List<T2>>(result, result2); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public Tuple<List<T>, List<T2>, List<T3>> SqlQuery<T, T2, T3>(string sql, object parameters = null) |
|
|
|
{ |
|
|
|
var parsmeterArray = this.GetParameters(parameters); |
|
|
@ -835,7 +834,6 @@ namespace SqlSugar |
|
|
|
return Tuple.Create<List<T>, List<T2>, List<T3>>(result, result2, result3); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public Tuple<List<T>, List<T2>, List<T3>, List<T4>> SqlQuery<T, T2, T3, T4>(string sql, object parameters = null) |
|
|
|
{ |
|
|
|
var parsmeterArray = this.GetParameters(parameters); |
|
|
@ -904,7 +902,6 @@ namespace SqlSugar |
|
|
|
return Tuple.Create<List<T>, List<T2>, List<T3>, List<T4>, List<T5>>(result, result2, result3, result4, result5); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public Tuple<List<T>, List<T2>, List<T3>, List<T4>, List<T5>, List<T6>> SqlQuery<T, T2, T3, T4, T5, T6>(string sql, object parameters = null) |
|
|
|
{ |
|
|
|
var parsmeterArray = this.GetParameters(parameters); |
|
|
@ -942,7 +939,6 @@ namespace SqlSugar |
|
|
|
return Tuple.Create<List<T>, List<T2>, List<T3>, List<T4>, List<T5>, List<T6>>(result, result2, result3, result4, result5, result6); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public Tuple<List<T>, List<T2>, List<T3>, List<T4>, List<T5>, List<T6>, List<T7>> SqlQuery<T, T2, T3, T4, T5, T6, T7>(string sql, object parameters = null) |
|
|
|
{ |
|
|
|
var parsmeterArray = this.GetParameters(parameters); |
|
|
@ -983,6 +979,211 @@ namespace SqlSugar |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<Tuple<List<T>, List<T2>>> SqlQueryAsync<T, T2>(string sql, object parameters = null) |
|
|
|
{ |
|
|
|
var parsmeterArray = this.GetParameters(parameters); |
|
|
|
this.Context.InitMappingInfo<T>(); |
|
|
|
var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig); |
|
|
|
builder.SqlQueryBuilder.sql.Append(sql); |
|
|
|
if (parsmeterArray != null && parsmeterArray.Any()) |
|
|
|
builder.SqlQueryBuilder.Parameters.AddRange(parsmeterArray); |
|
|
|
using (var dataReader =await this.GetDataReaderNoCloseAsync(builder.SqlQueryBuilder.ToSqlString(), builder.SqlQueryBuilder.Parameters.ToArray())) |
|
|
|
{ |
|
|
|
List<T> result =await this.DbBind.DataReaderToListNoUsingAsync<T>(typeof(T), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T2> result2 =await this.DbBind.DataReaderToListNoUsingAsync<T2>(typeof(T2), dataReader); |
|
|
|
builder.SqlQueryBuilder.Clear(); |
|
|
|
if (this.Context.Ado.DataReaderParameters != null) |
|
|
|
{ |
|
|
|
foreach (IDataParameter item in this.Context.Ado.DataReaderParameters) |
|
|
|
{ |
|
|
|
var parameter = parsmeterArray.FirstOrDefault(it => item.ParameterName.Substring(1) == it.ParameterName.Substring(1)); |
|
|
|
if (parameter != null) |
|
|
|
{ |
|
|
|
parameter.Value = item.Value; |
|
|
|
} |
|
|
|
} |
|
|
|
this.Context.Ado.DataReaderParameters = null; |
|
|
|
} |
|
|
|
return Tuple.Create<List<T>, List<T2>>(result, result2); |
|
|
|
} |
|
|
|
} |
|
|
|
public async Task<Tuple<List<T>, List<T2>, List<T3>>> SqlQueryAsync<T, T2, T3>(string sql, object parameters = null) |
|
|
|
{ |
|
|
|
var parsmeterArray = this.GetParameters(parameters); |
|
|
|
this.Context.InitMappingInfo<T>(); |
|
|
|
var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig); |
|
|
|
builder.SqlQueryBuilder.sql.Append(sql); |
|
|
|
if (parsmeterArray != null && parsmeterArray.Any()) |
|
|
|
builder.SqlQueryBuilder.Parameters.AddRange(parsmeterArray); |
|
|
|
using (var dataReader =await this.GetDataReaderNoCloseAsync(builder.SqlQueryBuilder.ToSqlString(), builder.SqlQueryBuilder.Parameters.ToArray())) |
|
|
|
{ |
|
|
|
List<T> result =await this.DbBind.DataReaderToListNoUsingAsync<T>(typeof(T), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T2> result2 =await this.DbBind.DataReaderToListNoUsingAsync<T2>(typeof(T2), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T3> result3 =await this.DbBind.DataReaderToListNoUsingAsync<T3>(typeof(T3), dataReader); |
|
|
|
builder.SqlQueryBuilder.Clear(); |
|
|
|
if (this.Context.Ado.DataReaderParameters != null) |
|
|
|
{ |
|
|
|
foreach (IDataParameter item in this.Context.Ado.DataReaderParameters) |
|
|
|
{ |
|
|
|
var parameter = parsmeterArray.FirstOrDefault(it => item.ParameterName.Substring(1) == it.ParameterName.Substring(1)); |
|
|
|
if (parameter != null) |
|
|
|
{ |
|
|
|
parameter.Value = item.Value; |
|
|
|
} |
|
|
|
} |
|
|
|
this.Context.Ado.DataReaderParameters = null; |
|
|
|
} |
|
|
|
return Tuple.Create<List<T>, List<T2>, List<T3>>(result, result2, result3); |
|
|
|
} |
|
|
|
} |
|
|
|
public async Task<Tuple<List<T>, List<T2>, List<T3>, List<T4>>> SqlQueryAsync<T, T2, T3, T4>(string sql, object parameters = null) |
|
|
|
{ |
|
|
|
var parsmeterArray = this.GetParameters(parameters); |
|
|
|
this.Context.InitMappingInfo<T>(); |
|
|
|
var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig); |
|
|
|
builder.SqlQueryBuilder.sql.Append(sql); |
|
|
|
if (parsmeterArray != null && parsmeterArray.Any()) |
|
|
|
builder.SqlQueryBuilder.Parameters.AddRange(parsmeterArray); |
|
|
|
using (var dataReader =await this.GetDataReaderNoCloseAsync(builder.SqlQueryBuilder.ToSqlString(), builder.SqlQueryBuilder.Parameters.ToArray())) |
|
|
|
{ |
|
|
|
List<T> result =await this.DbBind.DataReaderToListNoUsingAsync<T>(typeof(T), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T2> result2 =await this.DbBind.DataReaderToListNoUsingAsync<T2>(typeof(T2), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T3> result3 =await this.DbBind.DataReaderToListNoUsingAsync<T3>(typeof(T3), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T4> result4 =await this.DbBind.DataReaderToListNoUsingAsync<T4>(typeof(T4), dataReader); |
|
|
|
builder.SqlQueryBuilder.Clear(); |
|
|
|
if (this.Context.Ado.DataReaderParameters != null) |
|
|
|
{ |
|
|
|
foreach (IDataParameter item in this.Context.Ado.DataReaderParameters) |
|
|
|
{ |
|
|
|
var parameter = parsmeterArray.FirstOrDefault(it => item.ParameterName.Substring(1) == it.ParameterName.Substring(1)); |
|
|
|
if (parameter != null) |
|
|
|
{ |
|
|
|
parameter.Value = item.Value; |
|
|
|
} |
|
|
|
} |
|
|
|
this.Context.Ado.DataReaderParameters = null; |
|
|
|
} |
|
|
|
return Tuple.Create<List<T>, List<T2>, List<T3>, List<T4>>(result, result2, result3, result4); |
|
|
|
} |
|
|
|
} |
|
|
|
public async Task<Tuple<List<T>, List<T2>, List<T3>, List<T4>, List<T5>>> SqlQueryAsync<T, T2, T3, T4, T5>(string sql, object parameters = null) |
|
|
|
{ |
|
|
|
var parsmeterArray = this.GetParameters(parameters); |
|
|
|
this.Context.InitMappingInfo<T>(); |
|
|
|
var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig); |
|
|
|
builder.SqlQueryBuilder.sql.Append(sql); |
|
|
|
if (parsmeterArray != null && parsmeterArray.Any()) |
|
|
|
builder.SqlQueryBuilder.Parameters.AddRange(parsmeterArray); |
|
|
|
using (var dataReader = await this.GetDataReaderNoCloseAsync(builder.SqlQueryBuilder.ToSqlString(), builder.SqlQueryBuilder.Parameters.ToArray())) |
|
|
|
{ |
|
|
|
List<T> result = await this.DbBind.DataReaderToListNoUsingAsync<T>(typeof(T), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T2> result2 = await this.DbBind.DataReaderToListNoUsingAsync<T2>(typeof(T2), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T3> result3 = await this.DbBind.DataReaderToListNoUsingAsync<T3>(typeof(T3), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T4> result4 = await this.DbBind.DataReaderToListNoUsingAsync<T4>(typeof(T4), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T5> result5 = await this.DbBind.DataReaderToListNoUsingAsync<T5>(typeof(T5), dataReader); |
|
|
|
builder.SqlQueryBuilder.Clear(); |
|
|
|
if (this.Context.Ado.DataReaderParameters != null) |
|
|
|
{ |
|
|
|
foreach (IDataParameter item in this.Context.Ado.DataReaderParameters) |
|
|
|
{ |
|
|
|
var parameter = parsmeterArray.FirstOrDefault(it => item.ParameterName.Substring(1) == it.ParameterName.Substring(1)); |
|
|
|
if (parameter != null) |
|
|
|
{ |
|
|
|
parameter.Value = item.Value; |
|
|
|
} |
|
|
|
} |
|
|
|
this.Context.Ado.DataReaderParameters = null; |
|
|
|
} |
|
|
|
return Tuple.Create<List<T>, List<T2>, List<T3>, List<T4>, List<T5>>(result, result2, result3, result4, result5); |
|
|
|
} |
|
|
|
} |
|
|
|
public async Task<Tuple<List<T>, List<T2>, List<T3>, List<T4>, List<T5>, List<T6>>> SqlQueryAsync<T, T2, T3, T4, T5, T6>(string sql, object parameters = null) |
|
|
|
{ |
|
|
|
var parsmeterArray = this.GetParameters(parameters); |
|
|
|
this.Context.InitMappingInfo<T>(); |
|
|
|
var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig); |
|
|
|
builder.SqlQueryBuilder.sql.Append(sql); |
|
|
|
if (parsmeterArray != null && parsmeterArray.Any()) |
|
|
|
builder.SqlQueryBuilder.Parameters.AddRange(parsmeterArray); |
|
|
|
using (var dataReader =await this.GetDataReaderNoCloseAsync(builder.SqlQueryBuilder.ToSqlString(), builder.SqlQueryBuilder.Parameters.ToArray())) |
|
|
|
{ |
|
|
|
List<T> result =await this.DbBind.DataReaderToListNoUsingAsync<T>(typeof(T), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T2> result2 =await this.DbBind.DataReaderToListNoUsingAsync<T2>(typeof(T2), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T3> result3 =await this.DbBind.DataReaderToListNoUsingAsync<T3>(typeof(T3), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T4> result4 =await this.DbBind.DataReaderToListNoUsingAsync<T4>(typeof(T4), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T5> result5 =await this.DbBind.DataReaderToListNoUsingAsync<T5>(typeof(T5), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T6> result6 =await this.DbBind.DataReaderToListNoUsingAsync<T6>(typeof(T6), dataReader); |
|
|
|
builder.SqlQueryBuilder.Clear(); |
|
|
|
if (this.Context.Ado.DataReaderParameters != null) |
|
|
|
{ |
|
|
|
foreach (IDataParameter item in this.Context.Ado.DataReaderParameters) |
|
|
|
{ |
|
|
|
var parameter = parsmeterArray.FirstOrDefault(it => item.ParameterName.Substring(1) == it.ParameterName.Substring(1)); |
|
|
|
if (parameter != null) |
|
|
|
{ |
|
|
|
parameter.Value = item.Value; |
|
|
|
} |
|
|
|
} |
|
|
|
this.Context.Ado.DataReaderParameters = null; |
|
|
|
} |
|
|
|
return Tuple.Create<List<T>, List<T2>, List<T3>, List<T4>, List<T5>, List<T6>>(result, result2, result3, result4, result5, result6); |
|
|
|
} |
|
|
|
} |
|
|
|
public async Task<Tuple<List<T>, List<T2>, List<T3>, List<T4>, List<T5>, List<T6>, List<T7>>> SqlQueryAsync<T, T2, T3, T4, T5, T6, T7>(string sql, object parameters = null) |
|
|
|
{ |
|
|
|
var parsmeterArray = this.GetParameters(parameters); |
|
|
|
this.Context.InitMappingInfo<T>(); |
|
|
|
var builder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig); |
|
|
|
builder.SqlQueryBuilder.sql.Append(sql); |
|
|
|
if (parsmeterArray != null && parsmeterArray.Any()) |
|
|
|
builder.SqlQueryBuilder.Parameters.AddRange(parsmeterArray); |
|
|
|
using (var dataReader =await this.GetDataReaderNoCloseAsync(builder.SqlQueryBuilder.ToSqlString(), builder.SqlQueryBuilder.Parameters.ToArray())) |
|
|
|
{ |
|
|
|
List<T> result = await this.DbBind.DataReaderToListNoUsingAsync<T>(typeof(T), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T2> result2 = await this.DbBind.DataReaderToListNoUsingAsync<T2>(typeof(T2), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T3> result3 = await this.DbBind.DataReaderToListNoUsingAsync<T3>(typeof(T3), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T4> result4 = await this.DbBind.DataReaderToListNoUsingAsync<T4>(typeof(T4), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T5> result5 = await this.DbBind.DataReaderToListNoUsingAsync<T5>(typeof(T5), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T6> result6 = await this.DbBind.DataReaderToListNoUsingAsync<T6>(typeof(T6), dataReader); |
|
|
|
NextResult(dataReader); |
|
|
|
List<T7> result7 = await this.DbBind.DataReaderToListNoUsingAsync<T7>(typeof(T7), dataReader); |
|
|
|
builder.SqlQueryBuilder.Clear(); |
|
|
|
if (this.Context.Ado.DataReaderParameters != null) |
|
|
|
{ |
|
|
|
foreach (IDataParameter item in this.Context.Ado.DataReaderParameters) |
|
|
|
{ |
|
|
|
var parameter = parsmeterArray.FirstOrDefault(it => item.ParameterName.Substring(1) == it.ParameterName.Substring(1)); |
|
|
|
if (parameter != null) |
|
|
|
{ |
|
|
|
parameter.Value = item.Value; |
|
|
|
} |
|
|
|
} |
|
|
|
this.Context.Ado.DataReaderParameters = null; |
|
|
|
} |
|
|
|
return Tuple.Create<List<T>, List<T2>, List<T3>, List<T4>, List<T5>, List<T6>, List<T7>>(result, result2, result3, result4, result5, result6, result7); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static void NextResult(IDataReader dataReader) |
|
|
|
{ |
|
|
|
try |
|
|
|