2
我正在使用一个ADO.NET实体模型,我试图用LINQ查询。ADO.NET实体模型和LINQ
我遇到的问题是,我不能指定where子句,因为我想。例如,考虑以下查询:
AccountsDM db = new AccountsDM(ConfigurationManager.ConnectionStrings["PrimaryEF"].ConnectionString);
var accounts = from a in db.Accounts
select a;
foreach (var account in accounts)
{
foreach (var ident in account.Identifiers)
{
if (ident.Identifier == identifier)
{
// ident.Identifier is what I'd like to be filtering in the WHERE clause below
}
}
}
理想情况下,我想,要成为:
var accounts = from a in db.Accounts
where a.Identifiers.Identifier == identifier
select a;
我猜我可能不会在VS2010设置我的实体模型正确。任何建议,你可以提供将感激地收到。
谢谢,
理查德。
当你运行linq版本时会发生什么? – 2010-03-24 09:55:04