mh_frame_sps/APT.Infrastructure.EF/Map/EntityBaseMap.cs

30 lines
1.3 KiB
C#
Raw Permalink Normal View History

2026-04-07 13:47:52 +08:00
using APT.Infrastructure.Core;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace APT.Infrastructure.EF.Map
{
public abstract class EntityBaseMap<T, TKey> : IEntityTypeConfiguration<T> where T : EntityBase<TKey>
{
public virtual void Configure(EntityTypeBuilder<T> builder)
{
builder.HasKey(t => t.ID);
builder.Property(t => t.ORG_ID).IsRequired();
builder.Property(t => t.ENTITY_ORG_TPYE);
builder.Property(t => t.IS_DELETED);
builder.Property(t => t.CREATER_ID);
builder.Property(t => t.CREATE_TIME);
builder.Property(t => t.FLOW_STATUS);
builder.Property(t => t.MODIFIER_ID);
builder.Property(t => t.MODIFY_TIME);
builder.Property(t => t.FLOW_SEND_STATUS);
builder.Property(t => t.FLOW_ID);
builder.HasOne(t => t.Nav_Org).WithMany().HasForeignKey(t => t.ORG_ID).OnDelete(DeleteBehavior.Restrict);
builder.Ignore(t => t.SysParams);
builder.Ignore(t => t.Nav_SysParams);//.WithOptional().HasForeignKey(t => t.ENTITY_ID).WillCascadeOnDelete(true);
builder.Ignore(t => t.DbConn);
builder.Ignore(t => t.TaskID);
}
}
}