哪里的条件可以是 EF 中的列表?

Where condition can be a list in EF?

我有这个:

private List<int> linesId = new List<int>();
_materialRepository.ViewLineMaterialStatus()
                   .Where(i => i.LineId == linesId)
                   .Tolist();

我可以在 where 子句中分配一个列表吗?

您不能分配它 - 但您应该能够像这样查询它:

private List<int> linesId = new List<int>();
_materialRepository.ViewLineMaterialStatus()
                   .Where(i => linesId.Contains(i.LineId))
                   .Tolist();