在我的上一个项目中,我决定使用实体框架,一切都很顺利,直到我尝试使用“在哪里”,我收到一个错误。
经过一番小小的搜索后我想出了这个帖子 https://stackoverflow.com/questions/110314/linq-to-entities-building-where-clauses-to-test-collections-within-a-many-to-ma and 那个帖子 http://social.msdn.microsoft.com/forums/en-US/adodotnetentityframework/thread/095745fe-dcf0-4142-b684-b7e4a1ab59f0/.
这就是我想做的
var all = fooelements
.Where(l=>controlsToGet
.Contains(l.Control.Name));
是否有任何可以使用 lambda 表达式或 linq 与实体框架来处理它?
谢谢
基于之前的答案,我有一个提示可以让您轻松地在此处执行此操作:
提示 8 - 如何使用 LINQ to Entities 编写“WHERE IN”样式查询 http://blogs.msdn.com/alexj/archive/2009/03/26/tip-8-writing-where-in-style-queries-using-linq-to-entities.aspx
希望这可以帮助
亚历克斯·詹姆斯
项目经理 - 实体框架团队
实体框架技巧 http://blogs.msdn.com/alexj/archive/2009/03/26/index-of-tips.aspx
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)