当前位置:网站首页>【Bug】C# IQueryable里的元素更改不了值
【Bug】C# IQueryable里的元素更改不了值
2022-06-23 22:18:00 【我把生活交给了工作】
代码
代码有被更改过,也只是节选,不过大同小异
var sysPersonnels=SysPersonnelRepository.FindAsIQueryable(f => f.IsDeleted == 1 && f.SyncWithDhDeletedTime == null).IgnoreQueryFilters();
sysPersonnels= personel_Erp.Where(f => f.PersonnelName.Contains("测试")).Take(2);
foreach (SysPersonnel personnel in sysPersonnels)
{
personnel.SyncWithDhDeletedTime = DateTime.Now;
}
//foreach 完sysPersonnels里的SysPersonnel 的SyncWithDhDeletedTime 还是没有值 导致下列更新不起作用
SysPersonnelRepository.UpdateRange(sysPersonnels, x => new {
x.SyncWithDhDeletedTime
});
原因
更改为List之后就可以了
var personel_Erp=SysPersonnelRepository.FindAsIQueryable(f => f.IsDeleted == 1 && f.SyncWithDhDeletedTime == null).IgnoreQueryFilters().ToList();
personel_Erp= personel_Erp.Where(f => f.PersonnelName.Contains("测试")).Take(2).ToList();
具体原因不知,还望大神指点一二
网上有类似问题也没太看懂的:为啥更改不了IQueryable里面元素的属性?
边栏推荐
- IDEA 自动生成单元测试,效率倍增!
- Visual explanation of clockwise inner curve in Green's formula hole digging method
- Server2022 activation
- 嵌入式接口复习资料
- 图像分割-数据标注
- Preliminary understanding of 3D printing and laser cutting process
- [things about gbase] gbase 8s high availability technology and case analysis (issue 02)
- VS QT VTK 左下角显示同步小坐标轴
- Avoid confusion when switching between arouter components
- 高仿書旗小說 Flutter 版,學起來
猜你喜欢

smart-doc + Torna 兼容版本

Inftnews | where should the future of the creator economy go in the Web3 world?

ACM. Hj89 24 point operation ●●●

解决Slf4j日志不打印问题

三款很酷很骚气的底部导航

Digital property management has become a trend. How can traditional property companies achieve digital butterfly change through transformation?

Gbase observation: extended analytical database

Improvement of DC power distribution with open hall current sensor

VS QT VTK 左下角显示同步小坐标轴

Why do MySQL indexes use b+ trees at the bottom? After reading this article, you can easily handle the interview.
随机推荐
Graph theory (tree diameter)
A cartoon reading app highly imitating Tencent comics
Niuke.com: the double pointer problem of receiving rainwater
Loop caused by add of sublist in list
解决Slf4j日志不打印问题
IDEA 自动生成单元测试,效率倍增!
老龄化下背景下,综合能效管理平台为医院保驾护航
Improvement of DC power distribution with open hall current sensor
How to index websites in Google
Bitmap加载内存分析
Golang 类型断言
腾讯会议号设计的几种猜测
高仿斗鱼 APP
高仿书旗小说 Flutter 版,学起来
Facebook 开源微光效果 Shimmer
接私活必备的 6 个开源项目
PyQt5_QTableWidget分页单选右键菜单控件
List<? extends T>和List<?super T>区别
Stm32-------adc (voltage detection)
ARouter 组件之间跳转需免混淆