Skip to content

Commit 84d867d

Browse files
committed
#增加SQL执行前后事件#
1 parent c711a3d commit 84d867d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

APIJSON.NET/APIJSON.NET/Data/DbContext.cs

+8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ public DbContext(IConfiguration options)
1818
IsAutoCloseConnection = true,
1919
InitKeyType= InitKeyType.Attribute
2020
});
21+
Db.Aop.OnLogExecuted = (sql, pars) => //SQL执行完事件
22+
{
23+
24+
};
25+
Db.Aop.OnLogExecuting = (sql, pars) => //SQL执行前事件
26+
{
27+
28+
};
2129
}
2230
public SqlSugarClient Db;
2331
public DbSet<Login> LoginDb { get { return new DbSet<Login>(Db); } }

0 commit comments

Comments
 (0)