using FindAndDrive.Domain.Models.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace FindAndDrive.Persistence.EntityConfigurations { public class ApplicantFinanceConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.HasKey(k => k.ApplicantFinanceId); //Set Decimal columns' precision builder.Property(x => x.GrossIncome).HasPrecision(18, 2); builder.Property(x => x.NetIncome).HasPrecision(18, 2); builder.Property(x => x.LivingExpenses).HasPrecision(18, 2); builder.Property(x => x.Deposit).HasPrecision(18, 2); builder.Property(x => x.CalculatedGross).HasPrecision(18, 2); builder.Property(x => x.CalculatedNet).HasPrecision(18, 2); builder.Property(x => x.BureauExpenses).HasPrecision(18, 2); builder.Property(x => x.CalculatedLivingExpenses).HasPrecision(18, 2); builder.Property(x => x.CalculatedTotalExpenses).HasPrecision(18, 2); builder.Property(x => x.DisposableIncome).HasPrecision(18, 2); builder.Property(x => x.MonthlyFinancingAmount).HasPrecision(18, 2); builder.Property(x => x.TotalFinancingAmount).HasPrecision(18, 2); builder.Property(d => d.PredictorConfidence).HasConversion().HasMaxLength(15); //Specify max length on string fields only //builder.Property(p => p.Title).HasMaxLength(5); } } }