0
List<System.Linq.Expressions.Expression<Func<MyType, bool>>> lstPredicates = new List<System.Linq.Expressions.Expression<Func<MyType, bool>>>();
foreach (MyType myAccount in lstMyType)
{
System.Linq.Expressions.Expression<Func<MyType, bool>> predicate =
t => t.Account == myAccount.Account && t.Branch == myAccount.Branch;
lstPredicates.Add(predicate);
}
lstTransactions = Context.MyTrans
.Where(lstPredicates)
.ToList();
Ich versuche, das Nachschlagen in MyTrans
Tabelle nur einmal zu laufen, so dass ich bin der Aufbau eine Liste von Prädikaten auf. Ich möchte Transaktionen in einer Liste abrufen, in der Konto- und Zweigkombinationen in Transaktionen vorhanden sind.Liste der Prädikate in Entity Framework Where-Klausel
d Ich versuche, ein Prädikat wie
predicate = t =>
(t.Account == 123 && t.Branch == London)
|| (t.Account == 433 && t.Branch == Manchester)
||...
ich nur in Betracht ziehen würden einen einzigen expresion und .Contains() verwendet wird. Beispiel Wo (x => yourListOfIDs.Contains (x.Account) –