initial commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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(p => p.AutoNumber).IsUnique();
|
||||
builder.HasIndex(p => p.EmployeeId);
|
||||
|
||||
builder.HasOne(p => p.Employee)
|
||||
.WithMany()
|
||||
.HasForeignKey(p => p.EmployeeId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user