using FindAndDrive.Domain.Models.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace FindAndDrive.Persistence.EntityConfigurations { public class ApplicantPredicitionConfiguration: IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.HasKey(k => k.ApplicantPredictionId); builder.Property(d => d.ChancesOfApproval).HasConversion().HasMaxLength(50); //Set Decimal columns' precision builder.Property(x => x.EstimatedApprovalAmount).HasPrecision(18, 2); builder.Property(x => x.EstimatedFinanceSpend).HasPrecision(18, 2); builder.Property(x => x.EstimatedInsuranceSpend).HasPrecision(18, 2); //Not necassary to specify all collumns, collumns taken from models //Specify max length on string fields only //builder.Property(p => p.Title).HasMaxLength(5); builder.Property(p => p.ImprovementSuggestion).HasMaxLength(50); builder.Property(p => p.ImprovementSuggestionFull).HasMaxLength(500); } } }