Friday, November 13, 2015

Default boolean value in Entity Framework

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:

c# httpclient The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch

 If we get this error while trying to get http reponse using HttpClient object, it could mean that certificate validation fails for the remo...