efcore / EFCore.CheckConstraints

An Entity Framework Core plugin to automatically add check constraints in various situations
Apache License 2.0
330 stars 14 forks source link

UseEnumCheckConstraints does not respect DbContext conventions #154

Open iPilot opened 8 months ago

iPilot commented 8 months ago

When enum is derived from ulong and used as a type of a property that translates to a table column with TypeName configured using

protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
{
    configurationBuilder.Properties<ulong>(p => p.HaveColumnType("bigint"));
}

(regardless ColumnAttribute presence), then enum values for constraint are generated as floating point numbers (double or decimal it is not clear).

When ColumnAttribute and its TypeName property are provided explicitly then enum values are generated correctly.