To set a default value to bit column in EF edit the migration file manaully and add defaultvaluesql parameter like
AddColumn("Jobs", "IsAdvertisingRequired", c => c.Boolean(nullable: false, defaultValueSql: "0"));
Reference: http://stackoverflow.com/questions/5567567/default-bool-to-false-when-null-in-database-with-entity-framework-4-1-code-first
No comments:
Post a Comment