23913

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

Question:

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!

Answer1:

<a href="http://social.msdn.microsoft.com/forums/en-US/adodotnetentityframework/thread/095745fe-dcf0-4142-b684-b7e4a1ab59f0/" rel="nofollow">Here</a> 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. <a href="http://msdn.microsoft.com/en-us/library/bb386895%28v=VS.90%29.aspx" rel="nofollow">Entity SQL</a> should work without problem.

Recommend

  • Help refreshing list with notifyDataSetChanged()
  • Use @NodeEntity on interface/abstract class
  • Can not cast IMAPInputStream to Multipart
  • Java Scanner Take Input, call a method, then back to read more input not working
  • Customise NewtonSoft.Json for Value Object serialisation [duplicate]
  • Spring-MVC using a Converter to load object from path variable, but need to return 404 for unfound
  • Splitting on comma outside quotes when escaped quotes exist
  • Android: Why I am not receiving the BOOT_COMPLETED intent?
  • Why doesn't >= (greater than or equals) comparison work in Javascript?
  • How to use Linq-to-SQL without having to generate all the classes?
  • java.net.Socket > outputStream > BufferedOutputStream flush() confirmation
  • Android get Serial Number
  • I need help modifying a C# regular expression
  • Struts2 validation is not working properly, validation error messages not shown
  • Cannot create an instance of an interface (PagedList)
  • Continuous movement of a box in pygame
  • How to set repeating alarm using setExact and how to cancel the same?
  • Mutate value by using a value from a different row in a tibble
  • Original method still getting called in Moq even after CallBase = true/false
  • EntityDataSource query inner join
  • Unable to retrieve number before incoming call in marshmallow
  • Compare variables PHP
  • ValidationResult Returned From IValidatableObject.Validate Is Not Localized
  • Set cookie from Web Api 2 IAuthenticationFilter AuthenticateAsync method
  • Regex: Match everything except backreference
  • Get Users in Group from Azure AD via Microsoft Graph
  • Why == is different for Integer and String?
  • Where should I store a file in Android?
  • Dynamically generated lookup key for IQueryable
  • How to fail Phing without triggering backtrace
  • Linq Full Outer Join on Two Objects
  • How to get the index of element in the List in c#
  • Ruby on Rails App deployed to heroku showing “We're sorry, but something went wrong”
  • Consuming a WCF service in a Java Client using wsHttpBinding
  • Salesforce Different WSDL files and when to use
  • Specifying Castle WCF Integration Facility Endpoint Behavior per Endpoint
  • Time complexity of a program which involves multiple variables
  • Is there a amazon webstore API for customers?
  • Circular dependency while pushing http interceptor
  • Angular 2 constructor injection vs direct access