私はLinqクエリを書いています。 if条件に基づいてクエリに連結する方法はありますか?クエリのLinq to Entity - 条件を連結する方法
などが
from res in _db.Person
where res.Departments.ID == deptId
select res;
と私は真の条件を持っている場合、私はそれが「AND」タイプの条件を実装
from res in _db.Person
where res.Departments.ID == deptId && res.Departments.Type == deptType
select res;
を使用したいと思うかもしれ変数条件
バージョンであります別のコメントにORを必要としていると述べました。 –
このアプローチを使用してください。http://stackoverflow.com/questions/21512230/where-clause-with-multiple-unknown-conditions –