一对多,导航更新,仅更新子表,不更新主表 返回

SqlSugar
5 61

一对多,导航更新。

想强制仅更新子表,不更新主表,怎么办,谢谢。

热忱回答5

  • -

    0 回复
  • -

    0 回复
  • public class UpdateNavRootOptions
    {
         public string[] IgnoreColumns { get; set; }//主表更新忽略列(实体配置特性也可以方便的实现)
         public string[] UpdateColumns { get; set; }//只更新哪几列
         public bool IsInsertRoot { get; set; }//强制插入主表 可以实现 更新或者插入效果
         public string[] IgnoreInsertColumns { get; set; }//主表启用插入忽略列 5.1.3.58
         public bool IsDiffLogEvent { get; set; }//启用主表差异日志
         public object  DiffLogBizData { get; set; }//差异日志参数
         public bool IsDisableUpdateRoot { get; set; }//禁更新主表5.1.3.33-preview05  
     }
         
         
    db.UpdateNav(list,new UpdateNavRootOptions()
    {
        IsDisableUpdateRoot = true//禁止更新主表
    })
    .Include(x => x.Roles).ExecuteCommand();


    0 回复
  • 有这个功能

    0 回复
  • 非常感谢

    0 回复