如何解决办法"包含"对于.NET 3.5不支持 [英] How to workaround "Contains" for .net 3.5 don't support
问题描述
我写一个LINQ到实体:
I write a linq to Entity:
string[] groups = GetGroups();
var fList = from f in _store.wcf_ServerFarm
join a in _store.ClientAccess on f.ServerFarmName equals a.AccessServerFarmName
join s in _store.Service on f.ServerFarmName equals s.ServerFarmName
where groups.Contains(s.ServerMachineName)
select new { f.ServerFarmAddress, s.ServerMachineName, s.ServiceName, s.ServiceConfig, s.ServicePath };
但.NET 3.5不支持包含(),我不能升级的某些原因。如何找出它。我尝试使用任何(),ESQL等,没有工作。 谢谢!
But .net 3.5 didn't support Contains(), I couldn't upgrade it for some reason. how to figure out it. I try to use "Any(), esql" and so on ,didn't work. Thanks!
推荐答案
<一个href="http://social.msdn.microsoft.com/forums/en-US/adodotnetentityframework/thread/095745fe-dcf0-4142-b684-b7e4a1ab59f0/"相对=nofollow>这里说明解决办法,建筑自前pression。它在内部建立了一个查询串联了大量的或
运营商。没有更好的解决方法可能是适用于LINQ的EFv1。 实体SQL 应该没有问题。
Here is described workaround with building custom expression. Internally it builds a query concatenating a lot of OR
operators. No better workaround is probably available for LINQ in EFv1. Entity SQL should work without problem.
这篇关于如何解决办法&QUOT;包含&QUOT;对于.NET 3.5不支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!