27 lines
923 B
C#
27 lines
923 B
C#
|
|
using APT.Infrastructure.Core;
|
|||
|
|
using Microsoft.EntityFrameworkCore;
|
|||
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|||
|
|
|
|||
|
|
namespace APT.Infrastructure.EF.Map
|
|||
|
|
{
|
|||
|
|
public abstract class APTTreeEntityBaseMap<T>: APTEntityBaseMap<T> where T :MesTreeEntityBase
|
|||
|
|
{
|
|||
|
|
public override void Configure(EntityTypeBuilder<T> builder)
|
|||
|
|
{
|
|||
|
|
base.Configure(builder);
|
|||
|
|
builder.Property(t => t.TEXT).HasMaxLength(50);
|
|||
|
|
builder.Property(t => t.PARENT_ID);
|
|||
|
|
builder.Property(t => t.IS_LEAF);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public abstract class TreeEntityBaseMap<T> : APTTreeEntityBaseMap<T> where T : TreeEntityBase<T>
|
|||
|
|
{
|
|||
|
|
public override void Configure(EntityTypeBuilder<T> builder)
|
|||
|
|
{
|
|||
|
|
base.Configure(builder);
|
|||
|
|
builder.HasOne(t => t.Nav_Parent).WithMany(t=>t.Nav_Children).HasForeignKey(t => t.PARENT_ID).OnDelete(DeleteBehavior.Restrict);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|