Files
2026-07-21 14:08:10 +07:00

32 lines
1.0 KiB
C#

using Indotalent.Data.Entities;
using Indotalent.Shared.Consts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
public class PayrollComponentConfiguration : IEntityTypeConfiguration<PayrollComponent>
{
public void Configure(EntityTypeBuilder<PayrollComponent> builder)
{
builder.Property(e => e.PayrollDetailId)
.HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(e => e.ComponentName)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.ComponentType)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(e => e.Description)
.HasMaxLength(GlobalConsts.StringLengthShort);
builder.HasOne(e => e.PayrollDetail)
.WithMany(d => d.Components)
.HasForeignKey(e => e.PayrollDetailId)
.OnDelete(DeleteBehavior.NoAction);
builder.HasIndex(e => e.ComponentName);
}
}