Files
Backend-Api/CompanyManagment.EFCore/Mapping/PenaltyTitleMapping.cs
2024-07-05 21:36:15 +03:30

25 lines
793 B
C#

using Company.Domain.PenaltyTitle;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class PenaltyTitleMapping : IEntityTypeConfiguration<PenaltyTitle>
{
public void Configure(EntityTypeBuilder<PenaltyTitle> builder)
{
builder.ToTable("PenaltyTitles");
builder.HasKey(x => x.id);
builder.Property(x => x.FromDate)
.HasColumnType("datetime2(7)")
.IsRequired(false);
builder.Property(x => x.ToDate)
.HasColumnType("datetime2(7)")
.IsRequired(false);
//TODO
//add validations
builder.HasOne(x => x.Petition).WithMany(x => x.PenaltyTitlesList).HasForeignKey(x => x.Petition_Id);
}
}