I've created a simple extension method on the string type:
public static bool Contains(this string word, string[] values)
{
foreach(string s in values)
{
if(!word.Contains(s))
return false;
}
return true;
}
now, I've got a linq query that looks like this:
public static IEnumerable<ISearchable> Search(params string[] keywords)
{
XPQuery<Customer> customers = new XPQuery<Customer>(unitOfWork); // **
var found = from c in customers
where c.Notes.Contains(keywords)
select c;
return found.Cast<ISearchable>();
}
I get a 'method not supported' exception on the where clause, which will work fine if I use the string.Contains method.
Is there something wrong with my extension method, or the way I'm trying to use it in a linq where clause?
** XPQuery is a devexpress component, as that's the ORM I'm using, which is their linq-to-xpo query object.