美文网首页
EntityFramework CodeFirst SetDef

EntityFramework CodeFirst SetDef

作者: tensor初学者 | 来源:发表于2018-08-21 10:58 被阅读0次

If you see the generated migration code you will see AddColumn

AddColumn("dbo.report", "newProperty", c => c.String(nullable: false));
You can add defaultValue

AddColumn("dbo.report", "newProperty",
c => c.String(nullable: false, defaultValue: "old"));
Or add defaultValueSql

AddColumn("dbo.report", "newProperty",
c => c.String(nullable: false, defaultValueSql: "GETDATE()"));

相关文章

网友评论

      本文标题:EntityFramework CodeFirst SetDef

      本文链接:https://www.haomeiwen.com/subject/jhqfmftx.html