How can I set the default value using EntityFramework Code First FluentAPI for bool property?
Something like:
Property(l => l.PropertyFlag).HasColumnType("bit").DefaultValue(1);
cef-code-firstef-fluent-apientity-framework
How can I set the default value using EntityFramework Code First FluentAPI for bool property?
Something like:
Property(l => l.PropertyFlag).HasColumnType("bit").DefaultValue(1);
Best Answer
Good news, code first now supports this. In the "Up()" method of the generated migration, specify a default with the following syntax:
MSDN for "AddColumn" method