mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 增加 部分 LocalExecuteScalar Aop.CommandAfter 事件;#1481
This commit is contained in:
parent
62f4e42307
commit
85ab2b196e
@ -483,8 +483,21 @@ where a.database in ({0}) and a.table in ({1})", tboldname ?? tbname);
|
||||
cmd.CommandType = CommandType.Text;
|
||||
var before = new Aop.CommandBeforeEventArgs(cmd);
|
||||
this._orm?.Aop.CommandBeforeHandler?.Invoke(this._orm, before);
|
||||
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
|
||||
{
|
||||
|
@ -384,8 +384,21 @@ where a.table_schema IN ({0}) and a.table_name IN ({1}) and a.index_name <> 'PRI
|
||||
cmd.CommandType = CommandType.Text;
|
||||
var before = new Aop.CommandBeforeEventArgs(cmd);
|
||||
this._orm?.Aop.CommandBeforeHandler?.Invoke(this._orm, before);
|
||||
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
|
||||
{
|
||||
|
@ -476,8 +476,21 @@ use [" + database + "];", tboldname ?? tbname);
|
||||
cmd.CommandType = CommandType.Text;
|
||||
var before = new Aop.CommandBeforeEventArgs(cmd);
|
||||
this._orm?.Aop.CommandBeforeHandler?.Invoke(this._orm, before);
|
||||
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
|
||||
{
|
||||
|
@ -189,8 +189,21 @@ namespace FreeSql.GBase
|
||||
cmd.CommandType = CommandType.Text;
|
||||
var before = new Aop.CommandBeforeEventArgs(cmd);
|
||||
this._orm?.Aop.CommandBeforeHandler?.Invoke(this._orm, before);
|
||||
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
|
||||
{
|
||||
|
@ -395,8 +395,21 @@ where a.table_schema IN ({0}) and a.table_name IN ({1}) and a.index_name <> 'PRI
|
||||
cmd.CommandType = CommandType.Text;
|
||||
var before = new Aop.CommandBeforeEventArgs(cmd);
|
||||
this._orm?.Aop.CommandBeforeHandler?.Invoke(this._orm, before);
|
||||
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
|
||||
{
|
||||
|
@ -385,8 +385,21 @@ where a.table_schema IN ({0}) and a.table_name IN ({1}) and a.index_name <> 'PRI
|
||||
cmd.CommandType = CommandType.Text;
|
||||
var before = new Aop.CommandBeforeEventArgs(cmd);
|
||||
this._orm?.Aop.CommandBeforeHandler?.Invoke(this._orm, before);
|
||||
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
|
||||
{
|
||||
|
@ -477,8 +477,21 @@ use [" + database + "];", tboldname ?? tbname);
|
||||
cmd.CommandType = CommandType.Text;
|
||||
var before = new Aop.CommandBeforeEventArgs(cmd);
|
||||
this._orm?.Aop.CommandBeforeHandler?.Invoke(this._orm, before);
|
||||
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
|
||||
{
|
||||
|
@ -479,8 +479,21 @@ use [" + database + "];", tboldname ?? tbname);
|
||||
cmd.CommandType = CommandType.Text;
|
||||
var before = new Aop.CommandBeforeEventArgs(cmd);
|
||||
this._orm?.Aop.CommandBeforeHandler?.Invoke(this._orm, before);
|
||||
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
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user