I\'m using LINQ 2 Entities. Following is the problem:
string str = \'%test%.doc%\'
.Contains(str) // converts this into LIKE \'%~%test~%.doc~%%\'
So I was trying the same thing - trying to pair down a List to return all candidates that matched a SearchTerm. I wanted it so that if a user typed "Arizona" it would return everything regardless of case that had Arizona. Also, if the user typed "Arizona Cha", it would return items like "Arizona License Change". The following worked:
private List GetCertListBySearchString()
{
string[] searchTerms = SearchString.Split(' ');
List allCerts = _context.Certifications.ToList();
allCerts = searchTerms.Aggregate(allCerts, (current, thisSearchString) => (from ac in current
where ac.Name.ToUpper().Contains(thisSearchString.ToUpper())
select ac).ToList());
return allCerts;
}