如何使用 FluentMigrator 将值更新为 null

How to update value to null using FluentMigrator

如何使用 FluentMigrator 流畅语法将所有行更新为空?您不能将 null 分配给匿名类型 属性.

Update.Table("mytable").Set(new { supplierid = null }).AllRows();

我找到了问题的答案。您必须使用 DBNull.Value.

Update.Table("mytable").Set(new { supplierid = DBNull.Value }).AllRows();