sunpengfei
2025-08-07 59e73ad4283491cd407854874879e0ddc8dafaba
FlexJobApi.Core/Entities/Users/UserInfoCredential.cs
@@ -1,4 +1,7 @@
using System;
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
@@ -10,7 +13,7 @@
    /// <summary>
    /// 用户信息资格证书
    /// </summary>
    public class UserInfoCredential : CommonEntity
    public class UserInfoCredential : CommonEntity, IEntityTypeBuilder<UserInfoCredential>
    {
        /// <summary>
        /// 用户信息Id
@@ -23,9 +26,10 @@
        public UserInfo UserInfo { get; set; }
        /// <summary>
        /// 证书类型Id
        /// 证书类型编号
        /// </summary>
        public Guid? TypeId { get; set; }
        [Required]
        public string TypeCode { get; set; }
        /// <summary>
        /// 证书类型
@@ -69,5 +73,15 @@
        /// </summary>
        public string BackImg { get; set; }
        public void Configure(EntityTypeBuilder<UserInfoCredential> entityBuilder, DbContext dbContext, Type dbContextLocator)
        {
            entityBuilder
                .HasOne(it => it.Type)
                .WithMany()
                .HasForeignKey(it => it.TypeCode)
                .HasPrincipalKey(it => it.Code)
                .IsRequired()
                .OnDelete(DeleteBehavior.Restrict);
        }
    }
}