增加数据库根据Tracking进行更新的方法。
This commit is contained in:
parent
92eb80ae66
commit
deea9c1457
|
@ -94,6 +94,32 @@ namespace Falcon.SugarApi.DatabaseDefinitions
|
|||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 利用Tracking跟踪并更新数据
|
||||
/// </summary>
|
||||
/// <typeparam name="T">要跟踪更新的实体类型</typeparam>
|
||||
/// <param name="data">要跟踪更新的实体数据</param>
|
||||
/// <param name="changeValfun">修改实体数据</param>
|
||||
public void Update<T>(T data,Action<T> changeValfun) where T : class, new() {
|
||||
if(data == null) return;
|
||||
this.Tracking(data);
|
||||
changeValfun?.Invoke(data);
|
||||
this.Updateable(data).ExecuteCommand();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 利用Tracking跟踪并更新数据
|
||||
/// </summary>
|
||||
/// <typeparam name="T">要跟踪更新的实体类型</typeparam>
|
||||
/// <param name="data">要跟踪更新的实体数据</param>
|
||||
/// <param name="changeValfun">修改实体数据</param>
|
||||
public async void UpdateAsync<T>(T data,Action<T> changeValfun) where T : class, new() {
|
||||
if(data == null) return;
|
||||
this.Tracking(data);
|
||||
changeValfun?.Invoke(data);
|
||||
await this.Updateable(data).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 软删除
|
||||
|
|
Loading…
Reference in New Issue
Block a user