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

48 lines
2.2 KiB
C#

using Company.Domain.InstitutionContractAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class InstitutionContractMapping : IEntityTypeConfiguration<InstitutionContract>
{
public void Configure(EntityTypeBuilder<InstitutionContract> builder)
{
builder.ToTable("InstitutionContracts");
builder.HasKey(x => x.id);
builder.Property(x => x.ContractNo).HasMaxLength(40);
builder.Property(x => x.RepresentativeName).HasMaxLength(80);
builder.Property(x => x.ContractingPartyName).HasMaxLength(80);
builder.Property(x => x.ContractDateFa).HasMaxLength(10);
builder.Property(x => x.ContractStartFa).HasMaxLength(10);
builder.Property(x => x.ContractEndFa).HasMaxLength(10);
builder.Property(x => x.State).HasMaxLength(20);
builder.Property(x => x.City).HasMaxLength(30);
builder.Property(x => x.Address).HasMaxLength(250);
builder.Property(x => x.WorkshopManualCount).HasMaxLength(5);
builder.Property(x => x.EmployeeManualCount).HasMaxLength(10);
builder.Property(x => x.IsActiveString).HasMaxLength(5);
builder.Property(x => x.Description).HasMaxLength(10000);
builder.Property(x => x.Signature).HasMaxLength(1);
builder.Property(x => x.OfficialCompany).HasMaxLength(12);
builder.Property(x => x.TypeOfContract).HasMaxLength(30);
builder.Property(x => x.HasValueAddedTax).HasMaxLength(10);
builder.OwnsMany(x => x.WorkshopDetails, workshopDetail =>
{
workshopDetail.HasKey(x => x.id);
workshopDetail.WithOwner().HasForeignKey(x => x.InstitutionContractId);
workshopDetail.Property(x => x.WorkshopName).HasMaxLength(100);
workshopDetail.Property(x => x.WorkshopId).IsRequired(false);
});
builder.HasMany(x => x.Installments)
.WithOne(x => x.InstitutionContract)
.HasForeignKey(x => x.InstitutionContractId);
builder.HasMany(x => x.ContactInfoList)
.WithOne(x => x.InstitutionContracts)
.HasForeignKey(x => x.InstitutionContractId);
}
}