i am trying to write search query in linq based upon attributes of an object where object attributes can be null. i want to filter result if my column matches the value of some attribute. i.e object.country == "pakistan" then all the records of country pakistan should be displayed and if object.country is NULL then all records should be selected.
var query = from x in db.user_info
join y in db.user_detail_info on x.Id equals y.Id
where (key != null && key >= x.country) || (key == null)
select x;