consider the following code, which represents an attempt to implement partial matching. the intended result is a row for any 1 or more fields that match between the query entity and the data store.
so if you supply person.email we want a match against that, if you supply person.email and person.FirstName we should filter the results further, and so on.
var results = from p in db.Persons
where p.CrookBookUserName.Trim().Contains(person.CrookBookUserName.Trim()) ||
p.email.Trim().Contains(person.email.Trim()) ||
p.FirstName.Trim().Contains(person.FirstName.Trim()) ||
p.LastName.Trim().Contains(person.LastName.Trim()) ||
p.phone.Trim().Contains(person.phone.Trim())
select p;
return results;
unfortunately, this code always returns all rows in the db. why, and what should be the fix?
thanks in advance.