Files
blazor-hrm/Infrastructure/Database/MsSQL/Configuration/AppraisalConfiguration.cs
T
2026-07-21 14:08:10 +07:00

31 lines
1.4 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 AppraisalConfiguration : IEntityTypeConfiguration<Appraisal>
{
public void Configure(EntityTypeBuilder<Appraisal> builder)
{
builder.Property(a => a.AutoNumber).HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(a => a.EmployeeId).HasMaxLength(GlobalConsts.StringLengthId);
builder.Property(a => a.LastRating).HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(a => a.AppraisalType).HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(a => a.AppraisalNote).HasMaxLength(GlobalConsts.StringLengthMedium);
builder.Property(a => a.Status).HasMaxLength(GlobalConsts.StringLengthShort);
builder.Property(a => a.CurrentSalary).HasColumnType("decimal(18,2)");
builder.Property(a => a.IncrementPercentage).HasColumnType("decimal(18,2)");
builder.Property(a => a.NewSalary).HasColumnType("decimal(18,2)");
builder.HasIndex(a => a.AutoNumber).IsUnique();
builder.HasIndex(a => a.EmployeeId);
builder.HasOne(a => a.Employee)
.WithMany()
.HasForeignKey(a => a.EmployeeId)
.OnDelete(DeleteBehavior.NoAction);
}
}