<!-- 以下为必读项,不仔细阅读会导致你的 Issue 被关闭 1. 该分类下只能提交 Bug,如果要询问使用方法等,请前往讨论区:https://github.com/dotnetcore/FreeSql/discussions 2. FreeSql写了许多文档,在提问题前,麻烦先查看[常见问题](http://freesql.net/reference/faq.html) 3. 不完整的信息将不会得到任何回复!发布问题后,请保持对 issue 的关注,有时会有需要进一步沟通的信息,很长时间内没有得到答复的 issue 将被关闭。 4. 提供可重现的代码,至少应描述以下信息 --> #### 问题描述及重现步骤: Update的时候IgnoreColumns和字段上属性 CanUpdate = false没有同时生效,只有IgnoreColumns生效了 实体 [JsonProperty, Column(DbType = "varchar(30)", CanUpdate = false)] public string create_by { get; set; } = string.Empty; [JsonProperty, Column(DbType = "datetime", CanUpdate = false)] public DateTime create_time { get; set; } Sqldb.Update<crm_sale_order>().SetSource(dto).IgnoreColumns(s=>new {s.tag_count,s.gateway_count}).ExecuteAffrows(); 更新操作执行后create_by 和create_time 的值被更新了 CanUpdate 没有生效 #### 数据库的具体版本 ``` mysql5.7 ``` #### 安装的包 ``` freesql2.5.2 ``` #### .net framework/. net core? 及具体版本 ``` .net 5 ```
Activity
#803 fix IgnoreColumns CanUpdate false not work
2881099 commentedon Jun 27, 2021
CanUpdate = false 目前确实是在不使用 UpdateColumns/IgnoreColumns 时才有效,这个问题在初期就知道,找不到好的解决办法。因为有使用者需要单独用 UpdateColumns/IgnoreColumns 控制 CanUpdate = false 的属性,目前这样等于开放了一个入口操作。反之就不可操作了。
aprilyush commentedon Jun 29, 2021
好的 谢谢,麻烦叶大文档标注一下不能同时生效,谢谢啦
v2.6.100 #843 #816 #815 #804 #803 #802
worldofchu commentedon Nov 4, 2021
postgresql 12+
_tbrepo.Orm.Update().SetSource(tb111).ExecuteAffrows(); 对于 已经设置canupdate false的字段的 也是无效!!!!注意该字段同时设置了 canupdate和caninsert 都为false ,但是查询时候又需要所以 没设置ingore!
我看到2.6.1 版本说已经修正了此错误!验证了下 还是有这个问题啊 !!!-------ps 当然 我同时设置了 .IsVersion(true)
luoyunchong commentedon Nov 7, 2021
如何重现你的问题。
worldofchu commentedon Nov 8, 2021
参见#825 我同时设置了 .IsVersion(true)
worldofchu commentedon Nov 8, 2021
参见#825 我同时设置了 .IsVersion(true)