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

纵饮孤独 提交于 2019-12-12 05:47:57

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/6994730/how-to-workaround-contains-for-net-3-5-dont-support

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!