From 582de973fd627cc80a7e6f8d08e63308dad562f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=BD=87=E9=98=B3?= Date: Wed, 8 Nov 2023 10:21:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Elight.Entity/AuthManageProfile.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Elight.Entity/AuthManageProfile.cs b/Elight.Entity/AuthManageProfile.cs index 45dc2d0..2caa4bd 100644 --- a/Elight.Entity/AuthManageProfile.cs +++ b/Elight.Entity/AuthManageProfile.cs @@ -13,6 +13,8 @@ namespace Elight.Entity { public AuthManageProfile() { + this.CreateCusMap(); + CreateMap().ReverseMap(); CreateMap().ReverseMap(); CreateMap().ReverseMap(); @@ -21,7 +23,7 @@ namespace Elight.Entity CreateMap().ReverseMap(); CreateMap().ReverseMap(); - CreateMap(); + //CreateMap(); CreateMap(); @@ -41,4 +43,22 @@ namespace Elight.Entity CreateMap(); } } + public static class AutoMapperProFileExtension + { + public static void CreateCusMap(this Profile profile) + { + profile.CreateMap().ForAllMembers(opt => + { + opt.UseDestinationValue(); + opt.Condition((s, e, r, t) => + { + if (r == null) + { + return false; + } + else { return true; } + }); + }); + } + } }