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

  • Home
  • SEARCH
  • 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 8491673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:29:46+00:00 2026-06-10T22:29:46+00:00

I am using LINQ to create a list. But I want to use a

  • 0

I am using LINQ to create a list. But I want to use a function at the end to generate the object iself, something LINQ complains about

LINQ to Entities does not recognize the method 'WashroomStatusItem GetWashroomStatusForItem(WashroomStatus)' method, and this method cannot be translated into a store expression.

What am I doing wrong?

var query = (from c in context.WashroomStatus
    where c.WashroomId == GroupItem.WashroomID
    select GetWashroomStatusForItem(c));

private WashroomStatusItem GetWashroomStatusForItem(WashroomStatus item)
{
    WashroomStatusItem temp = new WashroomMonitorWCF.WashroomStatusItem();
    //do stuff with it
    return temp;
}
  • 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-10T22:29:48+00:00Added an answer on June 10, 2026 at 10:29 pm

    The problem is that the SQL conversion can’t convert your method into SQL. You should use AsEnumerable() to “switch” from the out-of-process provider to LINQ to Objects. For example:

    var query = context.WashroomStatus
                       .Where(c => c.WashroomId == GroupItem.WashroomID)
                       .AsEnumerable()
                       .Select(c => GetWashroomStatusForItem(c));
    

    Note that if GetWashroomStatusForItem only uses some properties, you may want to project to those separately first, to reduce the amount of information fetched from the server:

    var query = context.WashroomStatus
                       .Where(c => c.WashroomId == GroupItem.WashroomID)
                       .Select(c => new { c.Location, c.Date };
                       .AsEnumerable()
                       .Select(p => GetWashroomStatusForItem(p.Location, p.Date));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anybody got an idea of how to create a .Contains(string) function using Linq
I am using the JQuery.Sortable() function to create a reorderable list of items like
Below function working ok but I want to make it simple. if (list.Exists(delegate(string s)
I am trying to create a list of aggregate data by site, using linq
I am following Scott Gu's article to create a dynamic LINQ http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx He has
How can I create one query using both ICriteria and Linq? Example: var q
When using DataContext.CreateDatabase() to create a database, I wish to stop Linq To Sql
I am using LINQ to access my database, and thereby gets a LINQ-created object
Using LINQ to Entities, how can I determine if any item from a List
I have a list of strings in C#, and want to create a list

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.