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 8518687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:03:05+00:00 2026-06-11T06:03:05+00:00

Possible Duplicate: LINQ to Entities does not recognize the method I use Entity Framework

  • 0

Possible Duplicate:
LINQ to Entities does not recognize the method

I use Entity Framework 4.3

I write extension method:

public static IQueryable<TSource> Active<TSource>(this IQueryable<TSource> source) where TSource : class, IStatusable
{
    return source.Where(s => s.Status == (int)StatusEnum.Enabled);
}

This works good:

var cat=Context.Categories.Active().ToList()

But i need use this extension method in Select.
Look simplified query:

return Context.Categories
 .Select(c => new { Children=c.Children.AsQueryable().Active()})
 .ToList()

(Children – collection of child categories)
When query execution I get a error message:

LINQ to Entities does not recognize the method 'System.Linq.IQueryable`1[Portal.FrontOffice.Model.Category] Active[Category](System.Linq.IQueryable`1[Portal.FrontOffice.Model.Category])' method, and this method cannot be translated into a store expression.

Why does not work? How to write correctly?

  • 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-11T06:03:07+00:00Added an answer on June 11, 2026 at 6:03 am

    As stated in my comments, it is the very same reason every time this error message appears:

    The expression tree that is used by the EF provider to create the SQL contains a method it doesn’t understand.
    In your case, this is the Active extension method. It is part of the expression tree as it is used inside another expression (Select).

    In your first query, your method is NOT part of the expression tree. Instead it simply changes the expression tree by adding the Where expression to it. That is a fundamental difference.

    To make your second query work, use this:

    return Context.Categories 
                  .Select(c => new { Children=c.Children
                                               .Where(s => s.Status == 
                                                           (int)StatusEnum.Enabled) }) 
                  .ToList() 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Entity Framework Code First: decimal precision I'm using Linq-to-Entities with the EntityFramework
Possible Duplicate: “NOT IN” clause in LINQ to Entities I work with the schema
Possible Duplicate: Conditional Linq Queries Using Entity Framework 4.0 I have a search condition
Possible Duplicate: Linq to SQL “not like” operator How can I write a dynamic
Possible Duplicate: To return IQueryable<T> or not return IQueryable<T> I have LINQ to SQL
Possible Duplicate: 'Contains()' workaround using Linq to Entities? Using LINQ in C#, I have
Possible Duplicate: LINQ - Where not exists I'm using LINQ2SQL and I want to
Possible Duplicate: Use Linq to Xml with Xml namespaces I have an xml: <?xml
Possible Duplicate: Use LINQ to read all nodes from XML I am trying to
Possible Duplicate: How do I combine LINQ expressions into one? public bool IsUnique(params Expression<Func<Employee,

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.