我只想从_vwSourceEndpoints检索的sourceEndpoints获取SourceEndpointConfigs。我不确定如何修改where子句以获取正确的结果。感谢所有帮助。谢谢!
_vwSourceEndpoints = db.vwSourceEndpoints
.Where(e => e.StudySourceSystemId == study.StudySourceSystemId
& e.ScheduleId == study.ScheduleId
& e.OrderNo == study.OrderNo
& e.Active == true
).ToList();
_vwSourceEndpointConfigs = db.SourceEndpointConfigs.Where(
e => e.Active == true
).ToList();
var query3 = _vwSourceEndpointConfigs.Concat(_vwSourceEndpoints.OrderBy(x => x.OrderNo).ToList();
我已经想出了以下作为一个编辑我的原始代码
_vwSourceEndpoints = db.vwSourceEndpoints.Where(
e => e.StudySourceSystemId == study.StudySourceSystemId
& e.ScheduleId == study.ScheduleId
& e.OrderNo == study.OrderNo
& e.Active == true).ToList();
_vwSourceEndpointConfigs = db.SourceEndpointConfigs.Where(
e => _vwSourceEndpoints.All(x => x.StudySourceSystemId == study.StudySourceSystemId
& x.ScheduleId == study.ScheduleId
& x.OrderNo == study.OrderNo
& x.Active == true)
).ToList();
2条答案
按热度按时间5kgi1eie1#
如果两个表具有相同的列,则可以使用“联合”,否则选择所需的列,然后使用“联合”。
3okqufwl2#
这是我最终发现的最好的工作解决方案。