WHERE子句比方说,我有这两个表:与需要帮助的LINQ到SQL对外国表
ParentDataItem
ParentDataItemID
...some other fields...
ChildDataItem
ChildDataItemID
ParentDataItemID (foreign key)
Name
Value
现在我要选择有ChildDataItem具有指定名称和值的任何ParentDataItems。
我知道我的方式把我的第一种方法,这是这样的:
// db is the data context object
db.ParentDataItems.Where(p => p.ChildDataItems.Where(c => c.Name == "XXX" && c.Value == "XXX"));
我宁愿lambda语法,但无论是会做。
感谢您的链接到LINQPad - 其实我也它的一个安装我的机器 - 我想我可以开始使用它了。 – jhorback 2010-08-23 19:41:30