Files
blazor-saas-hrm/Infrastructure/Database/MsSQL/Configuration/PromotionConfiguration.cs
T
2026-07-21 14:22:06 +07:00

27 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 PromotionConfiguration : IEntityTypeConfiguration<Promotion>
{
public void Configure(EntityTypeBuilder<Promotion> builder)
{
builder.Property(p => p.AutoNumber).HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(p => p.EmployeeId).HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(p => p.FromGrade).HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(p => p.ToGrade).HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(p => p.PromotionNote).HasMaxLength(GlobalConsts.StringLengthMedium);
builder.Property(p => p.Status).HasMaxLength(GlobalConsts.StringLengthShort);
builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique();
builder.HasIndex(p => p.EmployeeId);
builder.HasOne(p => p.Employee)
.WithMany()
.HasForeignKey(p => p.EmployeeId)
.OnDelete(DeleteBehavior.NoAction);
}
}