Hey All!
I was just curious to see what others have done for searching with LLBLGen. I am using adapter. I am currently working on a search function that looks like this:
public int [] Search(string partNumber, string description,
string vendor, DateTime invoiceDate, string invoiceNumber,
decimal qty, decimal invoiceTotal, decimal totalPerUnit)
{
IPredicateExpression exp = new PredicateExpression();
if(partNumber != null)
{
if(exp.Count < 1)
exp.Add(PredicateFactory.Like(PartFieldIndex.PartNumber,partNumber));
}
if(description != null)
{
if(exp.Count < 1)
{
exp.Add(PredicateFactory.Like(PartFieldIndex.Description,description));
}
else
{
exp.AddWithOr(PredicateFactory.Like(PartFieldIndex.Description,description));
}
}
//validate rest of search fields
}
Has anyone else just used if statements to build up your expression? If not, what do you do? Thanks.