From a8b475881959d4a88d821951a615f03e7d0d1725 Mon Sep 17 00:00:00 2001 From: sunpengfei <i@angelzzz.com> Date: 星期四, 07 八月 2025 13:28:30 +0800 Subject: [PATCH] feat:字典优化 --- FlexJobApi.Core/Entities/Users/UserInfoExpectJob.cs | 22 ++++++++++++++++++---- 1 files changed, 18 insertions(+), 4 deletions(-) diff --git a/FlexJobApi.Core/Entities/Users/UserInfoExpectJob.cs b/FlexJobApi.Core/Entities/Users/UserInfoExpectJob.cs index 60b21b8..7bd8840 100644 --- a/FlexJobApi.Core/Entities/Users/UserInfoExpectJob.cs +++ b/FlexJobApi.Core/Entities/Users/UserInfoExpectJob.cs @@ -1,4 +1,7 @@ -锘縰sing System; +锘縰sing Furion.DatabaseAccessor; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -9,7 +12,7 @@ /// <summary> /// 鐢ㄦ埛淇℃伅鏈熸湜宀椾綅 /// </summary> - public class UserInfoExpectJob : CommonEntity + public class UserInfoExpectJob : CommonEntity, IEntityTypeBuilder<UserInfoExpectJob> { /// <summary> /// 鐢ㄦ埛淇℃伅Id @@ -22,13 +25,24 @@ public UserInfo UserInfo { get; set; } /// <summary> - /// 鏈熸湜宀椾綅Id + /// 鏈熸湜宀椾綅缂栧彿 /// </summary> - public Guid PersonalIdentityId { get; set; } + public string PersonalIdentityCode { get; set; } /// <summary> /// 鏈熸湜宀椾綅 /// </summary> public DictionaryData PersonalIdentity { get; set; } + + public void Configure(EntityTypeBuilder<UserInfoExpectJob> entityBuilder, DbContext dbContext, Type dbContextLocator) + { + entityBuilder + .HasOne(it => it.PersonalIdentity) + .WithMany() + .HasForeignKey(it => it.PersonalIdentityCode) + .HasPrincipalKey(it => it.Code) + .IsRequired() + .OnDelete(DeleteBehavior.Restrict); + } } } -- Gitblit v1.9.1