c# - Adding int property, EF keeps making it nullable column? -
i'm adding int property called order existing entity has records in db tables.
public class page : content { // ... public int order { get; set; } // ... }
however, when run "update-database", it's adding column nullable default value of null. tried using [defaultvalue(0)], setting default in constructor. neither work.
how can add column/property existing set of data , have populate non-null value of 0? thanks.
that's because of inheritance. not properties in derived types can defined not-nullable, because types in upper level of hierarchy doesn't have properties.
Comments
Post a Comment