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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:39:43+00:00 2026-05-21T09:39:43+00:00

I am using the following expressions: ProductRepository.Query.Include(Function(x) x.ChildProducts.Select(Function(y) y.PriceTiers.Where(Function(z) z.IsActive))).Where(Function(x) x.Categories.Any(Function(y) y.ID = ID))

  • 0

I am using the following expressions:

ProductRepository.Query.Include(Function(x) x.ChildProducts.Select(Function(y) y.PriceTiers.Where(Function(z) z.IsActive))).Where(Function(x) x.Categories.Any(Function(y) y.ID = ID))

And getting this error:

The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties.

If I remove this:

.Where(Function(z) z.IsActive)

It works fine, but I need to filter the inactive price tiers.

Any ideas?

Update

Here is my solution:

Public Function GetProductsByCategoryID(ID As Integer) As System.Collections.Generic.IEnumerable(Of Core.Entities.Product) Implements Core.Interfaces.IProductService.GetProductsByCategoryID
        Dim Col = ProductRepository.Query.Where(Function(x) x.Display AndAlso x.Categories.Any(Function(y) y.ID = ID)) _
                  .Select(Function(x) New With { _
                              .Product = x,
                              .ChildProducts = x.ChildProducts.Where(Function(y) y.Display).Select(Function(y) New With { _
                                                                                                       .ChildProduct = y,
                                                                                                       .PriceTiers = y.PriceTiers.Where(Function(z) z.IsActive)
                                                                                                   })
                          }).ToList.Select(Function(x) x.Product)

        Return Col

    End Function
  • 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-05-21T09:39:44+00:00Added an answer on May 21, 2026 at 9:39 am

    You can’t do that in single query without projection or separate query to load the navigation property. Lambda expression for Include accepts only dotted notation for references and Select for collections but you can’t do any filtering.

    Filtering is possible on in separate query when using DbContext API:

    var data = context.Entry(product)
                      .Collection(p => p.ChildProducts)
                      .Query()
                      // Here are your filters
                      .Load();
    

    Edit:

    Projection requires something like:

    var data = context.Products
                      .Where(...)
                      .Select(p => new 
                          {
                              Product = p,
                              ChildProducts = p.ChildProducts.Where(...)
                          });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to parse a C-function like tree expressions like the following (using
Are any of the following XPath expressions acceptable? Using version 2.3.1 of eclipselink @XmlPath(../header/@type)
How to capture the following pattern using JavaScript regular expressions? I would like to
I am using regular expressions to validate user input. The following code collects a
I need some help extracting the following bits of information using regular expressions. Here
I am using the following Expression to select all hyperlinks //a[@href] How can I
In my repository implementation I can run the following query using a lambda expression:
Using .NET regular expressions. Let's say I have the following text: ddddddddddd And I
Observe the following simple source code: using System; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit;
I'm new to regular expressions and I checked the following pattern using RegExr, but

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.