Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8434435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:39:15+00:00 2026-06-10T06:39:15+00:00

Below is my code . Please review it . 1. bool isUnavailable = db.Deploys.Where(p

  • 0

Below is my code . Please review it .

 1. bool isUnavailable = db.Deploys.Where(p => 
     p.HostEnvironmentId == Guid.Parse(host.ID) &&
     p.Status == (int)DeployStatus.Deploying).AsEnumerable().Any();

This one works.

The following statements doesn’t work.

2. bool isUnavailable = db.Deploys.Where(p => 
    p.HostEnvironmentId == Guid.Parse(host.ID) &&
    p.Status == (int)DeployStatus.Deploying).Any();//Error 

The Exception is

    An exception of type 'System.NotSupportedException' occurred in 
Microsoft.Data.Services.Client.DLL but was not handled in user code
    
    Additional information: The method 'Any' is not supported.


3. bool isUnavailable = db.Deploys.Where(p => 
        p.HostEnvironmentId.ToString() == host.ID &&
        p.Status == (int)DeployStatus.Deploying).AsEnumerable().Any();//Error

The Exception is

    An exception of type 'System.NotSupportedException' occurred in 
      Microsoft.Data.Services.Client.DLL but was not handled in user code
      Additional information: The expression (([10007].HostEnvironmentId.ToString() == 
"b7db845b-cec4-49af-8f4b-b419a4e44331") And ([10007].Status == 90)) is not supported.

The Deploys Class is the model which is built in the client proxy class of WCF Data service. I was using "add service reference" to create WCF client proxy class.

But as to the Generic List,
Supposed below code. it will works fine.

4.bool b=servers.Where(d => 
   d.status == (int)Enums.ServerStatus.Deploying ||
   d.status == int)Enums.ServerStatus.Unavailable).Any();

My question is

Why same way used in different Class got different result .(See the method 2 and method 4).

Why 2 and 3 don’t work.

Hope someone can help me . Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:39:17+00:00Added an answer on June 10, 2026 at 6:39 am

    LINQ has a concept of ‘providers’. When working with LINQ over different data sources, different things need to happen for identical LINQ queries depending on the data source.

    For example, when you want to use LINQ to query a database, the LINQ query needs to be converted to an SQL query. When the data source is OData, the query needs to be converted to a URL. There are different providers for each, and each provider supports a different subset of LINQ operators and other language constructs. LINQ-to-SQL, Entity Framework and LINQ-to-NHibernate are three popular LINQ providers for database access.

    In your case, you are using WCF Data Services which includes a LINQ provider for OData. Since in OData there is no way to express the .Any() LINQ operator, attempting to use it in a query with that provider throws an exception. By using .AsEnumerable() you’re essentially saying to stop using the OData LINQ provider at that point and start using the LINQ-to-Objects provider (which isn’t technically a provider, but conceptually you can think of it as one). That means only what comes before .AsEnumerable() will be converted to an OData query, causing to retrieve all the Deploy entities that match the .Where(), and after they have all been transferred to the client, the client will perform the .Any() by checking the number of Deploy entities it has received. This of course is bad if there are many such entities, it will cause unwanted transfer of data over the network when all you wanted is the server side (database probably) to check if there are any. Unfortunately, .Any() is not supported by OData 1.0 (I don’t know about OData 2.0).

    Also, OData may not support .ToString() either. You may need to compare the Guid structures directly, i.e. create a local variable that contains the GUID value you want to compare:

    var g = Guid.Parse("b7db845b-cec4-49af-8f4b-b419a4e44331")`
    

    And then in the query compare the GUIDs like so:

    x.HostedEnvironment == g
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please see below code: thrust::device_vector<int>::iterator whereToBegin = copyListOfNgramCounteachdoc.begin(); end = thrust::unique_by_key(end.first, end.first + numUniqueNgrams,end.second);
I have a memory leak at NSDate . Please review the code below. -(void)myMethods:(NSDate
Please review my brief example code below and tell me if there is better,
Please review my .htaccess code below. The code below was suggested by I User
Please review the example code below, I have a class file that is loaded
Please review below code and advice what needs to be done in order to
Please find the below code <?xml version=1.0 encoding=utf-8?> <mx:Application xmlns:mx=http://www.adobe.com/2006/mxml layout=absolute> <mx:Script> <![CDATA[ [Bindable]
Please look at the below code snippet and let me know how the out
I have a function(please see code below) which reads some data from the web.
In the below code , why b1.subtract() fails . Please explain me the reason

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.