25 lines
722 B
C#
25 lines
722 B
C#
using IRaCIS.Core.Domain.Models;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
|
|
{
|
|
public class DictionaryConfigration : IEntityTypeConfiguration<Dictionary>
|
|
{
|
|
|
|
|
|
public void Configure(EntityTypeBuilder<Dictionary> builder)
|
|
{
|
|
|
|
//自身同时存在一对多 和一对一的关系,配置一对多的就可以,一对一 不用配置,有点奇怪
|
|
builder.HasMany(t => t.ChildList).WithOne(t => t.Parent).HasForeignKey(d => d.ParentId);
|
|
|
|
}
|
|
}
|
|
}
|