Override ConfigureConventions to apply global restrictions on models.
This commit is contained in:
parent
8a4e8a41f3
commit
feafaba447
@ -42,6 +42,13 @@ public class DeadBallZoneLeagueDbContext : DbContext
|
|||||||
.HasName("GetEarliestMatch");
|
.HasName("GetEarliestMatch");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
|
||||||
|
{
|
||||||
|
// These apply to all the settings for all models.
|
||||||
|
configurationBuilder.Properties<string>().HaveMaxLength(100);
|
||||||
|
configurationBuilder.Properties<decimal>().HavePrecision(16, 2);
|
||||||
|
}
|
||||||
|
|
||||||
public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = default)
|
public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var entries = ChangeTracker.Entries<BaseDomainModel>().Where(
|
var entries = ChangeTracker.Entries<BaseDomainModel>().Where(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user