PetaPoco部分更新
本文关键字:更新 PetaPoco | 更新日期: 2023-09-27 18:14:35
是否有人拥有部分更新的petapoco源代码?根据petapoco文档,应该有这个特性。
http://www.toptensoftware.com/Articles/116/PetaPoco-Partial-Record-Updates但是我已经从github下载了源代码,但是缺少部分更新。如果有人有部分更新的源代码,请与我分享。
在Github的当前版本中,部分更新方法有两个"版本"(也许您需要拉出更改)。一个是在Database类上:
public int Update(object poco, IEnumerable<string> columns)
Github: https://github.com/CollaboratingPlatypus/PetaPoco/blob/adfbde3207a94d0de5c74188d8d1b5801a8be0b9/PetaPoco/PetaPoco.cs#L1433行号1443
用法:db.Update(u, new string[] { "last_login" });
,其中db是Database
的一个实例
另一个在TT生成的Record类中:
public int Update(IEnumerable<string> columns) { return repo.Update(this, columns); }
Github: https://github.com/CollaboratingPlatypus/PetaPoco/blob/adfbde3207a94d0de5c74188d8d1b5801a8be0b9/PetaPoco/Models/Generated/PetaPoco.Generator.ttinclude#L73 73行
用法:u.Update(new string[] { "last_login" });
,其中u为生成的TT Record<T>