可空类型字段的 ServiceStack Ormlite UpdateNonDefaults
ServiceStack Ormlite UpdateNonDefaults for nullable type field
请参考UpdateNonDefaults is ignoring boolean parameters set to false
bool
属性现在始终包含在 UpdateNonDefaults()
with this commit 中,这将使您可以执行以下操作:
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
此更改适用于 v4.0.39+,现在 available on MyGet。
请参考UpdateNonDefaults is ignoring boolean parameters set to false
bool
属性现在始终包含在 UpdateNonDefaults()
with this commit 中,这将使您可以执行以下操作:
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
此更改适用于 v4.0.39+,现在 available on MyGet。