I am trying to use predicate builder in the following code:
public ListResults<DBAccountDetail> GetAccountDetail(string[] salesForceKey)
{
try
{
using (var c = new SalesForceDataContext())
{
var predicate = PredicateBuilder.False<DBAccountDetail>();
foreach (var keyword in salesForceKey)
{
var temp = keyword;
predicate = predicate.Or(p => p.Id.Contains(temp));
}
var lret = c.DBAccountDetails.AsQueryable().Where(predicate).ToList();
return new ListResults<DBAccountDetail>(lret);
}
}
catch (Exception ex)
{
LogError("GetLegacyRateLetters()", ex);
return new ListResults<DBAccountDetail>(ex);
}
}
The problem is that on this line:
predicate = predicate.Or(p => p.Id.Contains(temp));
p.Id
will not intellisense out and throws a compilation error of:
No overload for method 'Or' takes 1 arguments