当前位置:网站首页>【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里面元素的属性?
边栏推荐
- Task queue of laravel
- Inftnews | where should the future of the creator economy go in the Web3 world?
- 一个人竟然撸了一个网易云音乐云村
- NLog details
- 1004. number of maximum consecutive 1 III ●●
- Some common tool functions in work
- Quelques fonctions d'outils couramment utilisées au travail
- Gbase observation: extended analytical database
- 一款高仿腾讯漫画的漫画阅读类 APP
- 嵌入式接口复习资料
猜你喜欢
随机推荐
2022山东健博会,济南国际大健康产业博览会,中国营养健康展
Thinking (86): master-slave realization idea
Innovative lampblack supervision in the management measures for the prevention and control of lampblack pollution in Deyang catering service industry (Draft for comments)
VS QT VTK 左下角显示同步小坐标轴
Nlog详解
2022 Shandong Health Expo, Jinan International Health Industry Expo, China Nutrition and Health Exhibition
Solve the problem that slf4j logs are not printed
Why do MySQL indexes use b+ trees at the bottom? After reading this article, you can easily handle the interview.
IDEA 自动生成单元测试,效率倍增!
图论(树的直径)
文言文能编程???
不容错过 | 华为内部资料--成功的项目管理PPT(123页)
Sorry, your USB cable may be wrong!
matlab实现对图像批量重命名
Install using snap in opencloudos NET 6
入参参数为Object,但传递过去却成了[object object] 是因为需要转为JSON格式
Stm32 - - - - interruption externe
Big guy on security privacy computing escort data security needs to pay attention to science and technology ethics at the same time
牛客网:接雨水的双指针问题
"Shanda Diwei Cup" the 12th Shandong ICPC undergraduate program design competition









