I have a list of account ids to retrieve from a different context and need to be able to do this:
List<Account> MyMethod(List<int> Accounts)
{
List<Account> accounts = dc.Accounts.Join(Accounts,
x => x.AccountID,
y => y,
(x, y) => x).ToList<Account>();
return accounts;
}
It's obviously not a working query but what is the best way to handle this kind of request?
:::::UPDATE::::
Basically I came up with this solution but it's not complete:
accounts = (from a in dc.Accounts
where Accounts.Contains(a.AccountID)
select a).ToList<Account>();
However, how do you write it as a lambda-expression? I can't get Accounts.Contains(x=>x.AccountID) to work for obvious reasons.