diff --git a/Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoProvider.cs index ff8c04e8c..34b3225fa 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoProvider.cs @@ -320,36 +320,6 @@ namespace SqlSugar throw ex; } } - public virtual IDataReader GetDataReaderNoClose(string sql, params SugarParameter[] parameters) - { - try - { - InitParameters(ref sql, parameters); - if (FormatSql != null) - sql = FormatSql(sql); - SetConnectionStart(sql); - var isSp = this.CommandType == CommandType.StoredProcedure; - if (this.ProcessingEventStartingSQL != null) - ExecuteProcessingSQL(ref sql, parameters); - ExecuteBefore(sql, parameters); - IDbCommand sqlCommand = GetCommand(sql, parameters); - IDataReader sqlDataReader = sqlCommand.ExecuteReader(); - if (isSp) - DataReaderParameters = sqlCommand.Parameters; - if (this.IsClearParameters) - sqlCommand.Parameters.Clear(); - ExecuteAfter(sql, parameters); - SetConnectionEnd(sql); - return sqlDataReader; - } - catch (Exception ex) - { - CommandType = CommandType.Text; - if (ErrorEvent != null) - ExecuteErrorEvent(sql, parameters, ex); - throw ex; - } - } public virtual DataSet GetDataSetAll(string sql, params SugarParameter[] parameters) { try @@ -478,36 +448,6 @@ namespace SqlSugar throw ex; } } - public virtual async Task GetDataReaderNoCloseAsync(string sql, params SugarParameter[] parameters) - { - try - { - InitParameters(ref sql, parameters); - if (FormatSql != null) - sql = FormatSql(sql); - SetConnectionStart(sql); - var isSp = this.CommandType == CommandType.StoredProcedure; - if (this.ProcessingEventStartingSQL != null) - ExecuteProcessingSQL(ref sql, parameters); - ExecuteBefore(sql, parameters); - var sqlCommand = GetCommand(sql, parameters); - var sqlDataReader = await sqlCommand.ExecuteReaderAsync(); - if (isSp) - DataReaderParameters = sqlCommand.Parameters; - if (this.IsClearParameters) - sqlCommand.Parameters.Clear(); - ExecuteAfter(sql, parameters); - SetConnectionEnd(sql); - return sqlDataReader; - } - catch (Exception ex) - { - CommandType = CommandType.Text; - if (ErrorEvent != null) - ExecuteErrorEvent(sql, parameters, ex); - throw ex; - } - } public virtual async Task GetScalarAsync(string sql, params SugarParameter[] parameters) { try @@ -828,7 +768,7 @@ namespace SqlSugar builder.SqlQueryBuilder.sql.Append(sql); if (parsmeterArray != null && parsmeterArray.Any()) builder.SqlQueryBuilder.Parameters.AddRange(parsmeterArray); - using (var dataReader = this.GetDataReaderNoClose(builder.SqlQueryBuilder.ToSqlString(), builder.SqlQueryBuilder.Parameters.ToArray())) + using (var dataReader = this.GetDataReader(builder.SqlQueryBuilder.ToSqlString(), builder.SqlQueryBuilder.Parameters.ToArray())) { DbDataReader DbReader = (DbDataReader)dataReader; List result = new List(); @@ -949,7 +889,7 @@ namespace SqlSugar 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())) + using (var dataReader = await this.GetDataReaderAsync(builder.SqlQueryBuilder.ToSqlString(), builder.SqlQueryBuilder.Parameters.ToArray())) { DbDataReader DbReader = (DbDataReader)dataReader; List result = new List(); diff --git a/Src/Asp.Net/SqlSugar/Interface/IAdo.cs b/Src/Asp.Net/SqlSugar/Interface/IAdo.cs index cfc13abcf..df2cbe4e8 100644 --- a/Src/Asp.Net/SqlSugar/Interface/IAdo.cs +++ b/Src/Asp.Net/SqlSugar/Interface/IAdo.cs @@ -59,7 +59,7 @@ namespace SqlSugar Task GetDataReaderAsync(string sql, object parameters); Task GetDataReaderAsync(string sql, params SugarParameter[] parameters); Task GetDataReaderAsync(string sql, List parameters); - Task GetDataReaderNoCloseAsync(string sql, params SugarParameter[] parameters); + object GetScalar(string sql, object parameters); object GetScalar(string sql, params SugarParameter[] parameters);