Ehsan Akbar
Ehsan Akbar

Reputation: 7299

Where condition can be a list in EF?

I have this :

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

Can I assign a list in the where clause ?

Upvotes: 2

Views: 1600

Answers (1)

marc_s
marc_s

Reputation: 755063

You can't assign it - but you should be able to query it like this:

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

Upvotes: 6

Related Questions