Synchronization code

This commit is contained in:
sunkaixuan
2023-06-19 19:06:03 +08:00
parent ea6b9694d4
commit 458e5fea7a
2 changed files with 7 additions and 0 deletions

View File

@@ -39,6 +39,10 @@ namespace SqlSugar
internal bool OldClearParameters { get; set; }
public IDataParameterCollection DataReaderParameters { get; set; }
public TimeSpan SqlExecutionTime { get { return AfterTime - BeforeTime; } }
/// <summary>
/// Add, delete and modify: the number of affected items;
/// </summary>
public int SqlExecuteCount { get; private set; } = 0;
public StackTraceInfo SqlStackTrace { get { return UtilMethods.GetStackTrace(); } }
public bool IsDisableMasterSlaveSeparation { get; set; }
internal DateTime BeforeTime = DateTime.MinValue;
@@ -428,6 +432,8 @@ namespace SqlSugar
int count = sqlCommand.ExecuteNonQuery();
if (this.IsClearParameters)
sqlCommand.Parameters.Clear();
// 影响条数
this.SqlExecuteCount = count;
ExecuteAfter(sql, parameters);
sqlCommand.Dispose();
return count;

View File

@@ -31,6 +31,7 @@ namespace SqlSugar
bool IsClearParameters { get; set; }
int CommandTimeOut { get; set; }
TimeSpan SqlExecutionTime { get; }
int SqlExecuteCount { get; }
IDbBind DbBind { get; }
void SetCommandToAdapter(IDataAdapter adapter, DbCommand command);
IDataAdapter GetAdapter();