使用以下代码,我如何获得包含任何 zip 列表但仅包含街道地址目的的记录的返回?这当前返回 zip 或街道地址的匹配项。
var zipPredicate = PredicateBuilder.False<NameAddress>();
List<string> zips = new List<string>();
zips.Add("90210");
zips.Add("90211");
foreach (var item in zips)
{
zipPredicate = zipPredicate.Or(n=> n.ZIP.Contains(item));
}
zipPredicate = zipPredicate.And(n=> n.Purpose=="Street Address");
var zipResult = from s in NameAddresses
.AsExpandable()
.Where(zipPredicate)
select new{s.ID, s.ZIP, s.Purpose};
zipResult.Dump();