I am trying to construct a LINQ query, with expression trees, to do the following:
I have a field in my ItemCode table called Labels, an example of the data contained in this field is "lamps lighting chandelier".
I want to allow the user to type in some text, i.e. "Red Lamp", and be able to search the Labels field, of the ItemCode, table where the text contains "Red" or "Lamp".
I am trying to recommend selections to the user, and this, while basic, is a good first step ... just need some help constructing the query.
I am using CSLA as my framework, here is an example of the code I currently have:
IQueryable<Data.ItemCode> query = ctx.DataContext.ItemCodes;
//
// ItemCodeId
//
if (criteria.Name != null)
query = query.Where(row => row.ItemCodeId.Contains(criteria.ItemCodeId));
//
// Name
//
if (criteria.Name != null)
query = query.Where(row => row.Name.Contains(criteria.Name));
var data = query.Select(row => ItemCodeInfo.FetchItemCodeInfo(row));
this.AddRange(data);
Thanks in advance!