Files
Backend-Api/CompanyManagment.EFCore/Mapping/InstitutionContractInstallmentMapping.cs

23 lines
888 B
C#

using Company.Domain.InstitutionContractAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class InstitutionContractInstallmentMapping : IEntityTypeConfiguration<InstitutionContractInstallment>
{
public void Configure(EntityTypeBuilder<InstitutionContractInstallment> builder)
{
builder.ToTable("InstitutionContractInstallments");
builder.HasKey(x => x.Id);
builder.Property(x => x.InstallmentDateFa).HasMaxLength(10).IsRequired();
builder.Property(x => x.Description).HasMaxLength(1000);
builder.Property(x => x.Amount).IsRequired();
builder.HasOne(x => x.InstitutionContract)
.WithMany(x => x.Installments)
.HasForeignKey(x => x.InstitutionContractId)
.OnDelete(DeleteBehavior.Cascade);
}
}