mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-05 05:07:57 +08:00
-
This commit is contained in:
parent
46cbe96611
commit
2cf85ba888
@ -235,7 +235,7 @@ namespace SqlSugar
|
|||||||
if (this.IsClearParameters)
|
if (this.IsClearParameters)
|
||||||
sqlCommand.Parameters.Clear();
|
sqlCommand.Parameters.Clear();
|
||||||
ExecuteAfter(sql, parameters);
|
ExecuteAfter(sql, parameters);
|
||||||
if (this.Context.CurrentConnectionConfig.IsAutoCloseConnection && this.Transaction == null) this.Close();
|
if (this.IsClose()) this.Close();
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
public virtual IDataReader GetDataReader(string sql, params SugarParameter[] parameters)
|
public virtual IDataReader GetDataReader(string sql, params SugarParameter[] parameters)
|
||||||
@ -245,8 +245,7 @@ namespace SqlSugar
|
|||||||
ExecuteProcessingSQL(ref sql, parameters);
|
ExecuteProcessingSQL(ref sql, parameters);
|
||||||
ExecuteBefore(sql, parameters);
|
ExecuteBefore(sql, parameters);
|
||||||
IDbCommand sqlCommand = GetCommand(sql, parameters);
|
IDbCommand sqlCommand = GetCommand(sql, parameters);
|
||||||
var isAutoClose = this.Context.CurrentConnectionConfig.IsAutoCloseConnection && this.Transaction == null;
|
IDataReader sqlDataReader = sqlCommand.ExecuteReader(this.IsClose() ? CommandBehavior.CloseConnection : CommandBehavior.Default);
|
||||||
IDataReader sqlDataReader = sqlCommand.ExecuteReader(isAutoClose ? CommandBehavior.CloseConnection : CommandBehavior.Default);
|
|
||||||
if (isSp)
|
if (isSp)
|
||||||
DataReaderParameters = sqlCommand.Parameters;
|
DataReaderParameters = sqlCommand.Parameters;
|
||||||
if (this.IsClearParameters)
|
if (this.IsClearParameters)
|
||||||
@ -267,7 +266,7 @@ namespace SqlSugar
|
|||||||
if (this.IsClearParameters)
|
if (this.IsClearParameters)
|
||||||
sqlCommand.Parameters.Clear();
|
sqlCommand.Parameters.Clear();
|
||||||
ExecuteAfter(sql, parameters);
|
ExecuteAfter(sql, parameters);
|
||||||
if (this.Context.CurrentConnectionConfig.IsAutoCloseConnection && this.Transaction == null) this.Close();
|
if (this.IsClose()) this.Close();
|
||||||
return ds;
|
return ds;
|
||||||
}
|
}
|
||||||
public virtual object GetScalar(string sql, params SugarParameter[] parameters)
|
public virtual object GetScalar(string sql, params SugarParameter[] parameters)
|
||||||
@ -281,7 +280,7 @@ namespace SqlSugar
|
|||||||
if (this.IsClearParameters)
|
if (this.IsClearParameters)
|
||||||
sqlCommand.Parameters.Clear();
|
sqlCommand.Parameters.Clear();
|
||||||
ExecuteAfter(sql, parameters);
|
ExecuteAfter(sql, parameters);
|
||||||
if (this.Context.CurrentConnectionConfig.IsAutoCloseConnection && this.Transaction == null) this.Close();
|
if (this.IsClose()) this.Close();
|
||||||
return scalar;
|
return scalar;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -603,6 +602,10 @@ namespace SqlSugar
|
|||||||
if (parameters == null) return null;
|
if (parameters == null) return null;
|
||||||
return base.GetParameters(parameters, propertyInfo, this.SqlParameterKeyWord);
|
return base.GetParameters(parameters, propertyInfo, this.SqlParameterKeyWord);
|
||||||
}
|
}
|
||||||
|
private bool IsClose()
|
||||||
|
{
|
||||||
|
return this.Context.CurrentConnectionConfig.IsAutoCloseConnection && this.Transaction == null;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user