如何进行“价值所在"在LINQ-to-Entities 3.5中 [英] How to do a "where in values" in LINQ-to-Entities 3.5

查看:47
本文介绍了如何进行“价值所在"在LINQ-to-Entities 3.5中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何使用LINQ-to-Entities应用值在何处"类型的条件吗?我已经尝试了以下方法,但是没有用:

Does anybody know how to apply a "where in values" type condition using LINQ-to-Entities? I've tried the following but it doesn't work:

var values = new[] { "String1", "String2" };  // some string values

var foo = model.entitySet.Where(e => values.Contains(e.Name));

我相信这在LINQ-to-SQL中有效吗?有什么想法吗?

I believe this works in LINQ-to-SQL though? Any thoughts?

推荐答案

Linq to Entities不支持包含.

IN和JOIN不是同一运算符(通过IN进行过滤永远不会更改查询的基数).

IN and JOIN are not the same operator (Filtering by IN never changes the cardinality of the query).

这篇关于如何进行“价值所在"在LINQ-to-Entities 3.5中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆