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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:45:45+00:00 2026-06-01T13:45:45+00:00

In a string based overload of Include we specify to include a collection and

  • 0

In a string based overload of Include we specify to include a collection and then a reference one level down simply by specifying relevant navigation properties in correct order:

query.Include("Level1Collection.Level2Reference");

But why when using an overload of Include that uses lambda expression, must we also use a Select statement to able to specify the above query:

query.Include(e => e.Level1Collection.Select(l1 => l1.Level2Reference)).

Why wouldn’t the following work:

query.Include.(e => e.Level1Collection.Level2Reference)

thank you

  • 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-01T13:45:47+00:00Added an answer on June 1, 2026 at 1:45 pm

    Because the compiler doesn’t recognize that the context has changed the meaning of the collection property from being a collection to being a stand-in for objects in the collection. And since the compiler doesn’t change based on context, neither does intellisense.

    When you feed Include a string statement, it knows it has to use reflection to know what properties to include anyway and there’s no type-checking on compile. The underlying method knows that when it sees a dot after a collection property in the string that it should parse the properties of the objects within the collection for the next referenced property rather than the collection itself (“Level2Reference” in this case).

    Or in other words: it’s magic. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Based on the following question: Check if one string is a rotation of other
This code basically translates characters based on position in one string to the character
I'm trying to split a string based on a particular character and then count
Using Python I want to randomly rearrange sections of a string based on a
My application builds many objects in memory based on filenames (among other string based
What's the easiest way to format a string based on another input string that
In a traditional Windows shell, I can use net helpmsg to get the string-based
Im trying to create a C based string menu where a user inputs a
I am writing a GUI based application where I read a string of values
Consider string.Format() whose parameters are a string and, among others in the overload 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.