當使用Linq的Union方法時,使用實體框架,在同一個IQueryable
上可以使用的次數是否有上限?Linq2Sql的聯合調用數量是否有限制?
考慮這個片段中,顯然有點做作:
public IQueryable<Person> GetPeople(IEnumerable<PersonDto> candidates)
{
var successful = this.peopleRepository.All().Where(p => false);
foreach(var candidate in candidates)
{
if (candidate.IsSuccessful())
{
var successfulCandidate = this.peopleRepository.All()
.Where(p => p.id == candidate.id);
successful = successful.Union(successfulCandidate);
}
}
return successful;
}
是否有限制次數,我可以聯合IQueryables
,仍然可以得到使用實體框架和SQL Server的結果嗎?
呵呵,沒有。你爲什麼認爲它應該? –