From f0bd6cc625fa448c4833ec557846b0d9d38015c0 Mon Sep 17 00:00:00 2001
From: 28810 <28810@YEXIANGQIN>
Date: Mon, 2 Mar 2020 20:57:56 +0800
Subject: [PATCH] =?UTF-8?q?-=20=E8=B0=83=E6=95=B4=20Ado.AopCommandExecutin?=
=?UTF-8?q?g/AopCommandExecuted=20=E5=88=B0=20Aop.CommandBefore/After?=
=?UTF-8?q?=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
FreeSql.DbContext/FreeSql.DbContext.xml | 7 ++
FreeSql/FreeSql.xml | 131 ------------------------
FreeSql/FreeSqlBuilder.cs | 18 ++--
3 files changed, 17 insertions(+), 139 deletions(-)
diff --git a/FreeSql.DbContext/FreeSql.DbContext.xml b/FreeSql.DbContext/FreeSql.DbContext.xml
index 2735cefb..ca7c357b 100644
--- a/FreeSql.DbContext/FreeSql.DbContext.xml
+++ b/FreeSql.DbContext/FreeSql.DbContext.xml
@@ -110,6 +110,13 @@
清空状态数据
+
+
+ 根据 lambda 条件删除数据
+
+
+
+
添加
diff --git a/FreeSql/FreeSql.xml b/FreeSql/FreeSql.xml
index 08d2c1b3..784479be 100644
--- a/FreeSql/FreeSql.xml
+++ b/FreeSql/FreeSql.xml
@@ -2260,137 +2260,6 @@
-
-
- 查询,若使用读写分离,查询【从库】条件cmdText.StartsWith("SELECT "),否则查询【主库】
-
-
-
-
-
-
-
-
- 查询,ExecuteReaderAsync(dr => {}, "select * from user where age > ?age", new { age = 25 })
-
-
-
-
-
-
- 查询
-
-
-
-
-
-
- 查询,ExecuteArrayAsync("select * from user where age > ?age", new { age = 25 })
-
-
-
-
-
-
-
- 查询
-
-
-
-
-
-
- 查询,ExecuteDataSetAsync("select * from user where age > ?age; select 2", new { age = 25 })
-
-
-
-
-
-
-
- 查询
-
-
-
-
-
-
- 查询,ExecuteDataTableAsync("select * from user where age > ?age", new { age = 25 })
-
-
-
-
-
-
-
- 在【主库】执行
-
-
-
-
-
-
-
- 在【主库】执行,ExecuteNonQueryAsync("delete from user where age > ?age", new { age = 25 })
-
-
-
-
-
-
-
- 在【主库】执行
-
-
-
-
-
-
-
- 在【主库】执行,ExecuteScalarAsync("select 1 from user where age > ?age", new { age = 25 })
-
-
-
-
-
-
-
- 执行SQL返回对象集合,QueryAsync<User>("select * from user where age > ?age", new SqlParameter { ParameterName = "age", Value = 25 })
-
-
-
-
-
-
-
-
-
- 执行SQL返回对象集合,QueryAsync<User>("select * from user where age > ?age", new { age = 25 })
-
-
-
-
-
-
-
-
- 执行SQL返回对象集合,Query<User>("select * from user where age > ?age; select * from address", new SqlParameter { ParameterName = "age", Value = 25 })
-
-
-
-
-
-
-
-
-
- 执行SQL返回对象集合,Query<User>("select * from user where age > ?age; select * from address", new { age = 25 })
-
-
-
-
-
-
可自定义解析表达式
diff --git a/FreeSql/FreeSqlBuilder.cs b/FreeSql/FreeSqlBuilder.cs
index 9309609d..26720246 100644
--- a/FreeSql/FreeSqlBuilder.cs
+++ b/FreeSql/FreeSqlBuilder.cs
@@ -249,14 +249,16 @@ namespace FreeSql
ret.CodeFirst.IsGenerateCommandParameterWithLambda = _isGenerateCommandParameterWithLambda;
ret.CodeFirst.IsLazyLoading = _isLazyLoading;
- ret.Aop.CommandBefore += new EventHandler((s, e) =>
- {
- _aopCommandExecuting(e.Command);
- });
- ret.Aop.CommandAfter += new EventHandler((s, e) =>
- {
- _aopCommandExecuted(e.Command, e.Log);
- });
+ if (_aopCommandExecuting != null)
+ ret.Aop.CommandBefore += new EventHandler((s, e) =>
+ {
+ _aopCommandExecuting?.Invoke(e.Command);
+ });
+ if (_aopCommandExecuted != null)
+ ret.Aop.CommandAfter += new EventHandler((s, e) =>
+ {
+ _aopCommandExecuted?.Invoke(e.Command, e.Log);
+ });
//添加实体属性名全局AOP转换处理
if (_entityPropertyConvertType != StringConvertType.None)