此查询适用于EF6:
var ids = new int[] { 1, 2, 3 };
var consultants = _dbContext.Times
.Where(t => ids.Contains(t.MilestoneId))
.Select(t => t.Consultant)
.Union(
_dbContext.TimeBudgets
.Where(tb => ids.Contains(tb.MilestoneId))
.Select(tb => tb.Consultant)
);
在EF7中,我收到错误:
An unhandled exception occurred while processing the request.