按照这个例子,方法InsertOnly的对应方式如何?
var updated = await dbCon.UpdateOnlyAsync(timesheet,
onlyFields:
x =>
new
{
x.LogInTime,
x.LogOffTime,
x.IsFlaggedByLeader,
x.LeaderComment,
x.IsModified
},
@where: x => x.Id == timesheet.Id) > 0;
我无法在互联网和Ormlite中找到一个例子 文档。
答案 0 :(得分:4)
您可以在ApiSqlServerTests中找到一些示例,例如:
db.InsertOnly(() => new Poco { FirstName = "Amy", Age = 27 });
db.InsertOnly(new Poco { FirstName = "Amy", Age = 27 },
p => new { p.FirstName, p.Age });
db.InsertOnly(new Poco { Age = 27 }, p => p.Age);
db.InsertOnly(new Poco { FirstName = "Amy", Age = 27 },
new[] { "FirstName", "Age" });
和ApiSqlServerTestsAsync中的异步版本,例如:
await db.InsertOnlyAsync(() => new Poco { FirstName = "Amy", Age = 27 });
await db.InsertOnlyAsync(new Poco { FirstName = "Amy", Age = 27 },
p => new { p.FirstName, p.Age });
await db.InsertOnlyAsync(new Poco { Age = 27 }, p => p.Age);
await db.InsertOnlyAsync(new Poco { FirstName = "Amy", Age = 27 },
new[] { "FirstName", "Age" });