23 lines
906 B
C#
23 lines
906 B
C#
|
|
|
|
using AccountManagement.Domain.SubAccountPermissionSubtitle3Agg;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace AccountMangement.Infrastructure.EFCore.Mappings
|
|
{
|
|
public class SubAccountPermissionSubtitle3Mapping : IEntityTypeConfiguration<SubAccountPermissionSubtitle3>
|
|
{
|
|
public void Configure(EntityTypeBuilder<SubAccountPermissionSubtitle3> builder)
|
|
{
|
|
builder.HasKey(x => x.id);
|
|
builder.ToTable("SubAccountPermissionSubtitle3");
|
|
builder.Property(x => x.Code).HasMaxLength(15).IsRequired();
|
|
builder.Property(x => x.Title).HasMaxLength(50).IsRequired();
|
|
|
|
builder.HasOne(x => x.Parent).WithMany(x => x.Children).HasForeignKey(x => x.ParentId);
|
|
builder.HasMany(x => x.Children).WithOne(x => x.Parent).HasForeignKey(x => x.ParentId);
|
|
}
|
|
}
|
|
}
|