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 { public void Configure(EntityTypeBuilder 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); } }