public object ExecuteScalar(string cmdText, DbParam[] parameters, CommandType cmdType) { this.CheckDisposed(); #if DEBUG System.Diagnostics.Debug.WriteLine(AppendDbCommandInfo(cmdText, parameters)); #endif try { IDbCommand cmd = this.DbCommand; List <OutputParameter> outputParameters = this.PrepareCommand(cmd, cmdText, parameters, cmdType); this.Activate(); object r = cmd.ExecuteScalar(); OutputParameter.CallMapValue(outputParameters); cmd.Parameters.Clear(); return(r); } finally { this.Complete(); } }
public void Close() { if (!this._reader.IsClosed) { try { this._reader.Close(); this._reader.Dispose();/* Tips:.NET Core 的 SqlServer 驱动 System.Data.SqlClient(4.1.0) 中,调用 DataReader.Dispose() 方法后才能拿到 Output 参数值,这算是坑爹么?? */ OutputParameter.CallMapValue(this._outputParameters); } finally { this._adoSession.Complete(); } } }
public void Close() { if (!this._reader.IsClosed) { try { this._reader.Close(); this._reader.Dispose();/* Tips:.NET Core 的 SqlServer 驱动 System.Data.SqlClient(4.1.0) 中,调用 DataReader.Dispose() 方法后才能拿到 Output 参数值。为了与 ChloeCore 版本的代码统一,也在这执行 DataReader.Dispose() 吧 */ OutputParameter.CallMapValue(this._outputParameters); } finally { this._dbSession.Complete(); } } }
public void Close() { if (!this._reader.IsClosed) { this._reader.Close(); try { OutputParameter.CallMapValue(this._outputParameters); this._cmd.Parameters.Clear(); } finally { this._dbSession.Complete(); } } }
public object ExecuteScalar(string cmdText, DbParam[] parameters, CommandType cmdType) { this.CheckDisposed(); IDbCommand cmd = null; try { List <OutputParameter> outputParameters; cmd = this.PrepareCommand(cmdText, parameters, cmdType, out outputParameters); DbCommandInterceptionContext <object> dbCommandInterceptionContext = new DbCommandInterceptionContext <object>(); IDbCommandInterceptor[] globalInterceptors = DbInterception.GetInterceptors(); this.Activate(); this.OnScalarExecuting(cmd, dbCommandInterceptionContext, globalInterceptors); object ret; try { ret = cmd.ExecuteScalar(); } catch (Exception ex) { dbCommandInterceptionContext.Exception = ex; this.OnScalarExecuted(cmd, dbCommandInterceptionContext, globalInterceptors); throw WrapException(ex); } dbCommandInterceptionContext.Result = ret; this.OnScalarExecuted(cmd, dbCommandInterceptionContext, globalInterceptors); OutputParameter.CallMapValue(outputParameters); return(ret); } finally { this.Complete(); if (cmd != null) { cmd.Dispose(); } } }