I have a table with one integer column that is not a primary or foreign key. It has a default value of -1.
EF auto-generated code has this setup for the table.
entity.Property(e => e.ControlFlag)
.HasColumnName("ControlFlag")
.HasDefaultValueSql("((-1))");
When I set ControlFlag=0
and add the row to the table by calling the EF Core SaveChanges()
method, the column gets saved with -1.
If I set ControlFlag=1
, the value saved in the column is 1.
Why does it not like to save 0?