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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:38:18+00:00 2026-06-06T09:38:18+00:00

Here’s sample model classes, which being use with Entity Framework Code First: public class

  • 0

Here’s sample model classes, which being use with Entity Framework Code First:

public class Master
{
  public int Id { get; set; }
  public Collection<Detail> Details { get; set; }
}

public class Detail
{
  public int Id { get; set; }
  public Master Master { get; set; }
  public SubDetail SubDetail1 { get; set; }
  public SubDetail SubDetail2 { get; set; }
}

public class SubDetail
{
  public int Id { get; set; }
}

I want to load Master with all of its details and sub-details explicitly. To load details I’m using Include:

context.Masters.Include("Details").Where(master => master.Id == 1);

What should I use to load sub-details?

  • 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-06T09:38:20+00:00Added an answer on June 6, 2026 at 9:38 am

    Try

    context.Masters.Include(m => m.Details.Select(d => d.SubDetail1))
       .Include(m => m.Details.Select(d => d.SubDetail2))
       .Where(master => master.Id == 1);
    

    Non generic version

    context.Masters.Include("Details.SubDetail1")
       .Include("Details.SubDetail2")
       .Where(master => master.Id == 1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here a simple question : What do you think of code which use try
here is the code public static final String DATE_TIME_FORMAT = yyyy-MM-dd kk:mm:ss; public static
Here is my class: public class A{ private void doIt(int[] X, int[] Y){ //change
Here is my code sample, let me know if it can be further improved?
Here is my code, which takes two version identifiers in the form 1, 5,
Here is my code: echo '<table class=class1><tbody>'; while ($row1=mysql_fetch_array($result1)){ echo '<tr><td>'.$row1['firstname'].'</td><td>'.$row1['lastname'].'</td></tr>'; } echo '</tbody></table>';
Here is a part of my code which sends an email: servidor = smtplib.SMTP()
here is the simple code: http://jsfiddle.net/YAFuW/1/ basicly i tried to use like this: <iframe
Here is the code: def Property(func): return property(**func()) class A: def __init__(self, name): self._name
Here is a JSFiddle that demonstrates the problem... http://jsfiddle.net/L2NBP/5/ For obvious reasons this code

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.