From 838335c00d3045771941047186c9cb767110bc03 Mon Sep 17 00:00:00 2001 From: 28810 <28810@YEXIANGQIN> Date: Thu, 26 Mar 2020 23:53:18 +0800 Subject: [PATCH] update --- AOP.md | 8 ++++---- 更新日志.md | 1 + 自定义特性.md | 4 ++-- 骚操作.md | 6 +++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/AOP.md b/AOP.md index cae223c..ecc4e00 100644 --- a/AOP.md +++ b/AOP.md @@ -7,7 +7,7 @@ FreeSql AOP 已有的功能介绍,未来为会根据用户需求不断增强 FreeSql 支持简单的类似功能: ```csharp -fsql.Aop.CurdAfter = (s, e) => { +fsql.Aop.CurdAfter += (s, e) => { if (e.ElapsedMilliseconds > 200) { //记录日志 //发送短信给负责人 @@ -72,7 +72,7 @@ A: 为了考虑一致性用法,全部封装在 ColumnAttribute 下,这样 FreeSql 提供 AOP 自定义特性功能,实现与多个 orm 共同拥有一套实体特性,可避免重复定义特性。 ```csharp -fsql.Aop.ConfigEntity = (s, e) => { +fsql.Aop.ConfigEntity += (s, e) => { var attr = e.EntityType.GetCustomAttributes( typeof(System.ComponentModel.DataAnnotations.Schema.TableAttribute), false).FirstOrDefault() as System.ComponentModel.DataAnnotations.Schema.TableAttribute; @@ -81,7 +81,7 @@ fsql.Aop.ConfigEntity = (s, e) => { //e.ModifyIndexResult.Add(new IndexAttribute("idx_xx", "Title")); //索引 }; -fsql.Aop.ConfigEntityProperty = (s, e) => { +fsql.Aop.ConfigEntityProperty += (s, e) => { if (e.Property.GetCustomAttributes( typeof(System.ComponentModel.DataAnnotations.KeyAttribute), false).Any()) e.ModifyResult.IsPrimary = true; //主键 @@ -99,7 +99,7 @@ FreeSql 内部表达式支持非常丰富,对各大数据库的兼容度也做 即便如此丰富,也仍然无法满足用户需求,FreeSql 对外开放了自定义表达式解析接口: ```csharp -fsql.Aop.ParseExpression = (s, e) => { +fsql.Aop.ParseExpression += (s, e) => { if (e.Expression.NodeType == Call && e.Expression.Name == "get_Item") e.Result = "1111"; }; diff --git a/更新日志.md b/更新日志.md index 0f0380e..3fff3b9 100644 --- a/更新日志.md +++ b/更新日志.md @@ -20,6 +20,7 @@ - 增加 延时属性重写类对 protected set 的支持; - 优化 ConnectionPool 提升被动连接断开的体验(会卡的可以升级); - 调整 Repository 接口定义,合并为一个 IBaseRepository; +- 优化 集合导航属性表达式中忘记使用 AsSelect() 的友好错误提示; ## v1.2.1 diff --git a/自定义特性.md b/自定义特性.md index 0b83476..4df4192 100644 --- a/自定义特性.md +++ b/自定义特性.md @@ -3,13 +3,13 @@ ```csharp fsql.CodeFirst.ConfigEntity(a => a.Property(b => b.pkid).IsPrimary(true)); -fsql.Aop.ConfigEntity = (s, e) => { +fsql.Aop.ConfigEntity += (s, e) => { var attr = e.EntityType.GetCustomAttributes(typeof(System.ComponentModel.DataAnnotations.Schema.TableAttribute), false).FirstOrDefault() as System.ComponentModel.DataAnnotations.Schema.TableAttribute; if (attr != null) e.ModifyResult.Name = attr.Name; //表名 //e.ModifyIndexResult.Add(new IndexAttribute("idx_xx", "Title")); //索引 }; -fsql.Aop.ConfigEntityProperty = (s, e) => { +fsql.Aop.ConfigEntityProperty += (s, e) => { if (e.Property.GetCustomAttributes(typeof(System.ComponentModel.DataAnnotations.KeyAttribute), false).Any()) e.ModifyResult.IsPrimary = true; //主键 }; diff --git a/骚操作.md b/骚操作.md index 4d10d99..97941c1 100644 --- a/骚操作.md +++ b/骚操作.md @@ -286,12 +286,12 @@ var sql1 = fsql.Select() 抛砖引玉,以下的示例代码,FreeSql 使用 EFCore 的实体特性: ```csharp -fsql.Aop.ConfigEntity = (s, e) => { +fsql.Aop.ConfigEntity += (s, e) => { var attr = e.EntityType.GetCustomAttributes(typeof(System.ComponentModel.DataAnnotations.Schema.TableAttribute), false).FirstOrDefault() as System.ComponentModel.DataAnnotations.Schema.TableAttribute; if (attr != null) e.ModifyResult.Name = attr.Name; //表名 }; -fsql.Aop.ConfigEntityProperty = (s, e) => { +fsql.Aop.ConfigEntityProperty += (s, e) => { if (e.Property.GetCustomAttributes(typeof(System.ComponentModel.DataAnnotations.KeyAttribute), false).Any()) e.ModifyResult.IsPrimary = true; //主键 }; @@ -315,7 +315,7 @@ class ModelAopConfigEntity { FreeSql 支持简单的类似功能: ```csharp -fsql.Aop.CurdAfter = (s, e) => { +fsql.Aop.CurdAfter += (s, e) => { if (e.ElapsedMilliseconds > 200) { //记录日志 //发送短信给负责人