Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update操作的时候CanUpdate=false 未生效 #803

Closed
aprilyush opened this issue Jun 18, 2021 · 6 comments
Closed

Update操作的时候CanUpdate=false 未生效 #803

aprilyush opened this issue Jun 18, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@aprilyush
Copy link

aprilyush commented Jun 18, 2021

问题描述及重现步骤:

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
@luoyunchong luoyunchong added the bug Something isn't working label Jun 18, 2021
@2881099
Copy link
Collaborator

2881099 commented Jun 27, 2021

CanUpdate = false 目前确实是在不使用 UpdateColumns/IgnoreColumns 时才有效,这个问题在初期就知道,找不到好的解决办法。因为有使用者需要单独用 UpdateColumns/IgnoreColumns 控制 CanUpdate = false 的属性,目前这样等于开放了一个入口操作。反之就不可操作了。

@aprilyush
Copy link
Author

CanUpdate = false 目前确实是在不使用 UpdateColumns/IgnoreColumns 时才有效,这个问题在初期就知道,找不到好的解决办法。因为有使用者需要单独用 UpdateColumns/IgnoreColumns 控制 CanUpdate = false 的属性,目前这样等于开放了一个入口操作。反之就不可操作了。

好的 谢谢,麻烦叶大文档标注一下不能同时生效,谢谢啦

2881099 added a commit that referenced this issue Aug 31, 2021
@worldofchu
Copy link

worldofchu commented Nov 4, 2021

postgresql 12+
_tbrepo.Orm.Update().SetSource(tb111).ExecuteAffrows(); 对于 已经设置canupdate false的字段的 也是无效!!!!注意该字段同时设置了 canupdate和caninsert 都为false ,但是查询时候又需要所以 没设置ingore!
我看到2.6.1 版本说已经修正了此错误!验证了下 还是有这个问题啊 !!!-------ps 当然 我同时设置了 .IsVersion(true)

@luoyunchong
Copy link
Collaborator

postgresql 12+ _tbrepo.Orm.Update().SetSource(tb111).ExecuteAffrows(); 对于 已经设置canupdate false的字段的 也是无效!!!!注意该字段同时设置了 canupdate和caninsert 都为false ,但是查询时候又需要所以 没设置ingore! 我看到2.6.1 版本说已经修正了此错误!验证了下 还是有这个问题啊 !!!-------ps 当然 我同时设置了 .IsVersion(true)

如何重现你的问题。

@worldofchu
Copy link

参见#825 我同时设置了 .IsVersion(true)

@worldofchu
Copy link

postgresql 12+ _tbrepo.Orm.Update().SetSource(tb111).ExecuteAffrows(); 对于 已经设置canupdate false的字段的 也是无效!!!!注意该字段同时设置了 canupdate和caninsert 都为false ,但是查询时候又需要所以 没设置ingore! 我看到2.6.1 版本说已经修正了此错误!验证了下 还是有这个问题啊 !!!-------ps 当然 我同时设置了 .IsVersion(true)

如何重现你的问题。

参见#825 我同时设置了 .IsVersion(true)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants