If I search within a description field using Linq I receive different results when searching with these two queries. First by this %MODULE%ALLEN BRADLEY%
and then second by this query %ALLEN BRADLEY%MODULE%
. I would like these search queries to give me a result where these words appear in any place of the description field.
I read about sql that using LIKE
searches for pattern in string in a correct order, for instance searching for %MODULE%ALLEN BRADLEY%
would force the result to be in that particular order within the string. However using the keyword "In" searches for the wildcards anywhere within the string.
How would I achieve that in Linq?
This is my Linq method:
public List<Item> SearchItems(string itemid, string description)
{
return (from allitems in _dbc.Items
where SqlMethods.Like(allitems.Number, itemid)
&& SqlMethods.Like(allitems.DESCRIPTION, description)
select allitems);
}