适用于可空类型字段的ServiceStack Ormlite UpdateNonDefaults

时间:2015-03-24 18:05:12

标签: ormlite-servicestack

1 个答案:

答案 0 :(得分:0)

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