问题
Please refer UpdateNonDefaults is ignoring boolean parameters set to false
回答1:
bool
properties are now always included in UpdateNonDefaults()
with this commit which will let you do the following:
public class Poco
{
public int Id { get; set; }
public bool Bool { get; set; }
}
var db = OpenDbConnection();
db.DropAndCreateTable<Poco>();
db.Insert(new Poco { Id = 1, Bool = true });
db.UpdateNonDefaults(new Poco { Bool = false }, x => x.Id == 1);
var row = db.SingleById<Poco>(1);
row.Bool // false
This change is available from v4.0.39+ that's now available on MyGet.
来源:https://stackoverflow.com/questions/29239823/servicestack-ormlite-updatenondefaults-for-nullable-type-field