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

1

0

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!

Simoniac answered 9/8, 2011 at 10:26 Comment(1)
Related: #88973Marissamarist
I
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.

Idiocrasy answered 9/8, 2011 at 10:54 Comment(2)
But my Query included 2 "join" sentences , it's really hard to use this solution.Simoniac
That is the burden of Entity Framework alpha version (aka EFv1)Idiocrasy

© 2022 - 2024 — McMap. All rights reserved.