- 增加 部分 LocalExecuteScalar Aop.CommandAfter 事件;#1481

This commit is contained in:
2881099
2023-04-18 00:43:18 +08:00
parent 62f4e42307
commit 85ab2b196e
8 changed files with 113 additions and 9 deletions

View File

@ -477,7 +477,20 @@ use [" + database + "];", tboldname ?? tbname);
cmd.CommandType = CommandType.Text;
var before = new Aop.CommandBeforeEventArgs(cmd);
this._orm?.Aop.CommandBeforeHandler?.Invoke(this._orm, before);
return cmd.ExecuteScalar();
Exception afterException = null;
try
{
return cmd.ExecuteScalar();
}
catch (Exception ex)
{
afterException = ex;
throw;
}
finally
{
this._orm?.Aop.CommandAfterHandler?.Invoke(this._orm, new Aop.CommandAfterEventArgs(before, afterException, null));
}
}
}
finally