36 lines
1.2 KiB
C#
36 lines
1.2 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 PayrollDetailConfiguration : IEntityTypeConfiguration<PayrollDetail>
|
|
{
|
|
public void Configure(EntityTypeBuilder<PayrollDetail> builder)
|
|
{
|
|
builder.Property(e => e.PayrollProcessId)
|
|
.HasMaxLength(GlobalConsts.StringLengthId);
|
|
|
|
builder.Property(e => e.EmployeeId)
|
|
.HasMaxLength(GlobalConsts.StringLengthId);
|
|
|
|
builder.Property(e => e.EmployeeCode)
|
|
.HasMaxLength(GlobalConsts.StringLengthShort);
|
|
|
|
builder.Property(e => e.EmployeeName)
|
|
.HasMaxLength(GlobalConsts.StringLengthShort);
|
|
|
|
builder.HasOne(e => e.PayrollProcess)
|
|
.WithMany()
|
|
.HasForeignKey(e => e.PayrollProcessId)
|
|
.OnDelete(DeleteBehavior.NoAction);
|
|
|
|
builder.HasOne(e => e.Employee)
|
|
.WithMany()
|
|
.HasForeignKey(e => e.EmployeeId)
|
|
.OnDelete(DeleteBehavior.NoAction);
|
|
|
|
builder.HasIndex(e => e.EmployeeCode);
|
|
}
|
|
} |