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

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -