开发者

How to workaround "Contains" for .net 3.5 don't support

开发者 https://www.devze.com 2023-03-26 17:49 出处:网络
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

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 };

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!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号