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