为所有数据库 CodeFirst 中的 LocalExecuteScalar 增加 AOP

This commit is contained in:
hyzx86
2023-04-04 16:28:54 +08:00
parent 181fb90ef6
commit aa13fc49a7
10 changed files with 38 additions and 4 deletions

View File

@ -78,7 +78,7 @@ namespace FreeSql.Custom.MySql
{
Object<DbConnection> conn = null;
string database = null;
try
{
conn = _orm.Ado.MasterPool.Get(TimeSpan.FromSeconds(5));
@ -382,6 +382,8 @@ where a.table_schema IN ({0}) and a.table_name IN ({1}) and a.index_name <> 'PRI
{
cmd.CommandText = sql;
cmd.CommandType = CommandType.Text;
var before = new Aop.CommandBeforeEventArgs(cmd);
this._orm?.Aop.CommandBeforeHandler?.Invoke(this._orm, before);
return cmd.ExecuteScalar();
}
}

View File

@ -474,6 +474,8 @@ use [" + database + "];", tboldname ?? tbname);
{
cmd.CommandText = sql;
cmd.CommandType = CommandType.Text;
var before = new Aop.CommandBeforeEventArgs(cmd);
this._orm?.Aop.CommandBeforeHandler?.Invoke(this._orm, before);
return cmd.ExecuteScalar();
}
}