42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using Company.Domain.InsuranceListAgg;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace CompanyManagment.EFCore.Mapping;
|
|
|
|
public class InsuranceListMapping : IEntityTypeConfiguration<InsuranceList>
|
|
{
|
|
public void Configure(EntityTypeBuilder<InsuranceList> builder)
|
|
{
|
|
builder.ToTable("InsuranceLists");
|
|
builder.HasKey(x => x.id);
|
|
|
|
builder.Property(x => x.Year).HasMaxLength(4);
|
|
builder.Property(x => x.Month).HasMaxLength(2);
|
|
|
|
builder.ComplexProperty(x => x.Inspection, inspection =>
|
|
{
|
|
inspection.IsRequired();
|
|
inspection.Property(x => x.Type).HasConversion<string>().HasMaxLength(50);
|
|
inspection.Property(x => x.LastInspectionDateTime);
|
|
inspection.Property(x => x.MediaId);
|
|
});
|
|
|
|
builder.ComplexProperty(x => x.Debt, debt =>
|
|
{
|
|
debt.IsRequired();
|
|
debt.Property(x => x.Type).HasConversion<string>().HasMaxLength(50);
|
|
debt.Property(x => x.DebtDate);
|
|
debt.Property(x => x.Amount);
|
|
debt.Property(x => x.MediaId);
|
|
});
|
|
|
|
builder.ComplexProperty(x => x.EmployerApproval, approval =>
|
|
{
|
|
approval.IsRequired();
|
|
approval.Property(x => x.Status).HasConversion<string>().HasMaxLength(50);
|
|
approval.Property(x => x.Description).HasMaxLength(500);
|
|
});
|
|
|
|
}
|
|
} |