sunpengfei
3 天以前 b288e7effa0edc09baad6089433a38b2b29b29db
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace FlexJobApi.Core
{
    public class TaskInfoCredentialLimit : CommonEntity<MasterDbContextLocator>, IEntityTypeBuilder<TaskInfoCredentialLimit>
    {
        /// <summary>
        /// 任务Id
        /// </summary>
        public Guid TaskInfoId { get; set; }
 
        /// <summary>
        /// 任务
        /// </summary>
        public TaskInfo TaskInfo { get; set; }
 
        /// <summary>
        /// 证书类型编号
        /// </summary>
        [Required]
        public string TypeCode { get; set; }
 
        /// <summary>
        /// 证书类型
        /// </summary>
        public DictionaryData Type { get; set; }
 
        public void Configure(EntityTypeBuilder<TaskInfoCredentialLimit> entityBuilder, DbContext dbContext, Type dbContextLocator)
        {
            entityBuilder
                .HasOne(it => it.Type)
                .WithMany()
                .HasForeignKey(it => it.TypeCode)
                .HasPrincipalKey(it => it.Code)
                .IsRequired()
                .OnDelete(DeleteBehavior.Restrict);
        }
    }
}