From 79616ef58353d98b2ca55705d06daed86d1c175c Mon Sep 17 00:00:00 2001 From: 2881099 <2881099@users.noreply.github.com> Date: Thu, 26 Dec 2024 08:49:13 +0800 Subject: [PATCH] Update aop.md --- docs/guide/aop.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/guide/aop.md b/docs/guide/aop.md index 0afae7f07..4cf4f96a4 100644 --- a/docs/guide/aop.md +++ b/docs/guide/aop.md @@ -78,13 +78,16 @@ fsql.Aop.SyncStructureBefore、fsql.Aop.SyncStructureAfter 这两个事件将排 ## ConfigEntity -### 统一设置架构 +### 统一设置架构名 + +提前设置 FreeSqlBuilder AOP 优先级: + +UseMappingPriority(MappingPriorityType.Attribute, MappingPriorityType.FluentApi, MappingPriorityType.Aop) ```csharp -//提前设置 FreeSqlBuilder AOP 优先级 -//UseMappingPriority(MappingPriorityType.Attribute, MappingPriorityType.FluentApi, MappingPriorityType.Aop) -fsql.Aop.ConfigEntity += (s, e) => { +fsql.Aop.ConfigEntity += (s, e) => +{ e.ModifyResult.Name = "public." + e.ModifyResult.Name; //提示:可以利用 AsyncLocal 动态设置表名 v3.2.833 }; @@ -95,7 +98,8 @@ fsql.Aop.ConfigEntity += (s, e) => { 默认情况 c# 枚举会映射为 MySql Enum 类型,如果想映射为 int 在 FreeSqlBuilder Build 之后执行以下 Aop 统一处理: ```csharp -fsql.Aop.ConfigEntityProperty += (s, e) => { +fsql.Aop.ConfigEntityProperty += (s, e) => +{ if (e.Property.PropertyType.IsEnum) e.ModifyResult.MapType = typeof(int); };