FreeSql icon indicating copy to clipboard operation
FreeSql copied to clipboard

Update SetSource 添加where条件时,会自动加上主键的判断

Open icejd opened this issue 1 year ago • 2 comments

问题描述及重现代码:

fsql.Update<Resume_Category_ModulesModel>().SetSource(model).Where(m => m.categoryid == model.categoryid && m.modulename == model.modulename).ExecuteAffrows()>0;

上面的语句会自动添加上主键的判断,但是我不需要对主键进行判断,这很烦恼 UPDATE [resume_category_modules] SET [categoryid] = @p_0, [modulename] = @p_1, [title] = @p_2, [body] = @p_3, [visible] = @p_4, [sort] = @p_5, [data] = @p_6 WHERE ([moduleid] = 0) AND ([categoryid] = 1 AND [modulename] = N'intention')

数据库版本

sql server 2022

安装的Nuget包

FreeSql.Provider.SqlServer

.net framework/. net core? 及具体版本

.net 8

### Tasks

icejd avatar May 21 '24 03:05 icejd

实体的属性是 [Column(IsIdentity = true)] public long moduleid { get; set; }

icejd avatar May 21 '24 04:05 icejd

用 Set 或者 SetDto

2881099 avatar May 21 '24 09:05 2881099