From feafaba4471e6a8d0f84875c2a3ba37837de859b Mon Sep 17 00:00:00 2001 From: Kevin Matsubara Date: Mon, 14 Apr 2025 21:49:18 +0200 Subject: [PATCH] Override ConfigureConventions to apply global restrictions on models. --- EntityFrameworkCore.Data/DeadBallZoneLeagueDbContext.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/EntityFrameworkCore.Data/DeadBallZoneLeagueDbContext.cs b/EntityFrameworkCore.Data/DeadBallZoneLeagueDbContext.cs index fbeb099..b54e3e5 100644 --- a/EntityFrameworkCore.Data/DeadBallZoneLeagueDbContext.cs +++ b/EntityFrameworkCore.Data/DeadBallZoneLeagueDbContext.cs @@ -42,6 +42,13 @@ public class DeadBallZoneLeagueDbContext : DbContext .HasName("GetEarliestMatch"); } + protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder) + { + // These apply to all the settings for all models. + configurationBuilder.Properties().HaveMaxLength(100); + configurationBuilder.Properties().HavePrecision(16, 2); + } + public override Task SaveChangesAsync(CancellationToken cancellationToken = default) { var entries = ChangeTracker.Entries().Where(