Closed CN-HM closed 1 year ago
.Include(c => c.SysAlarmUserMerges.Where(d=>d.IsDeleted == false))
在这条语句中,加入了Where(d=>d.IsDeleted == false)就出现了问题,数据库匹配IsDeleted为false的数据为0条,匹配IsDeleted为true的有三条,但是使用.ProjectToType
Materialize your list first with ToList().
我使用的是NET6,EFCore 7。 Mapster版本:7.3.0
I'm using NET6, EFCore 7. Mapster version: 7.3.0
有问题的语句: Problematic statement: var res = await _sysAlarmSettingsRepository.DetachedEntities.Include(c => c.SysAlarmUserMerges.Where(d=>d.IsDeleted == false)) .ThenInclude(c => c.User) .Where(c => searchText == null || c.AlarmName.Contains(searchText)) .Where(c => c.IsDeleted == false) .OrderByDescending(c => c.Id) .ProjectToType()
.ToPagedListAsync(pageIndex, pageSize);
当我不使用这条语句时行为正常。 Behavior is normal when I don't use this statement.// .ProjectToType()
ListForAlarmSettingDto数据模型只是对SysAlarmUser进行了简单的删减。 The ListForAlarmSettingDto data model simply cuts SysAlarmUser.
我认为问题可能出在内部处理,我还没有看源码,先暂时提出这个问题。 I think the problem may be handled internally, I haven't looked at the source code yet, so let's raise this issue for the time being.