List<string>.Contains - not supported ???? RRS feed

  • Question

  • Hey all,

    I need your help in solving the following problem.

    I want to execute the following linq query

    tStrList is a List<string> and Zip is the zip code of varchar(10);

    var _zipQuery = from zpCode in ObjContext.Zip
                              where tStrList.Contains(zpCode.Zip)
                              select zpCode;

    zipQuery = (DataSErviceQuery<Zip>_zipQuery;

    zipQuery.BeginExecute(OnZipLoadComplete, zipQuery);

    When the zipQuery.BeginExecute(OnZipLoadComplete, zipQuery); statement is executed I get the following error:

    The expression value(System.Collections.Generic.List`1[System.String]).Contains([10007].Zip1) is not supported.

    How can I fix this.

    Please help!
    Thank you!


    • Moved by Sarah Parra - MSFT Thursday, February 5, 2009 10:28 PM (Moved from ADO.NET Entity Framework and LINQ to Entities to ADO.NET Data Services)
    Thursday, February 5, 2009 2:33 PM


All replies

  • Hi Eva, I'm not the most expert person about Astoria but I've experienced several problems with extension methods, so could you please provide some more information about your scenario? e.g. are you creating a Silverlight client library?

    By the way, unfortunately not all the extension methods are supported on the client side. So, in my opinion a (general) good choice could be implementing a service operation on the service side to return filtered data. But it would be better to know something more about the scenario where your application is running in.

    Thank you.

    Alessandro Del Sole - Microsoft MVP http://community.visual-basic.it/Alessandro
    Saturday, February 7, 2009 12:43 AM
  • Contains is not supported on this version of the Data Service nor is Count and other methods. You are better of using service operations if you ling query is complex. However Count will be supported on the next release.

    Daniel Portella - http://undocnet.blogspot.com - This posting is provided "AS IS" with no warranties, and confers no rights. If this post is answered your question please mark as the answer and if it is helpful do like wise.
    • Proposed as answer by Daniel Portella Thursday, February 12, 2009 12:05 AM
    Thursday, February 12, 2009 12:05 AM
  • This thread is a duplicate from

    Please stop responding to this thread. Thanks.



    Peter Q.
    Thursday, February 12, 2009 9:39 PM