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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:22:05+00:00 2026-06-15T05:22:05+00:00

Using mvc3 and entity framework 4. In sql server, the Steps table has foreign

  • 0

Using mvc3 and entity framework 4.
In sql server, the “Steps” table has foreign key constraint to “Question” via stepID.
The query (below) steps includes any associated questions.

var steps = from b in db.Steps.Include(s => s.Questions)
            orderby b.StepOrder
            select b;

return View(steps.ToList());

I want to also pull “answers” associated to questions.
In sql server, the “Questions” table has foreign key contraint to “Answers” via questionID.
How do I change the query to include answers associate to questions which are associated to steps?

  • 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-15T05:22:06+00:00Added an answer on June 15, 2026 at 5:22 am

    You need to Select the grandchildren inside the Include

    var steps = from b in db.Steps.Include(s => s.Questions.Select(q => q.Answers))
                orderby b.StepOrder
                select b;
    
    return View(steps.ToList());
    

    See Eagerly loading multiple levels section in the Loading Related Entities EF tutorial.

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

Sidebar

Related Questions

I got a MVC3 application using Entity Framework 4 and SQL Server. How can
I'm working on ASP.Net MVC3 web-site with Entity Framework and SQL Server 2008 as
My table Sections (SQL Server) has ID as a primary key (int, identity) and
I am working on a MVC3 application with entity framework and SQL Server 2008.
I'm using Entity Framework 4 with an MVC3 application to access data. My SQL
I am using MVC3 and Entity Framework. I have a List on a page
I am building a movie site. I am using mvc3 and entity framework. I
I am building a test application using MVC3, Razor, and Entity Framework 4.1 with
I'm setting up a blog using Asp.net MVC3 and Entity framework 4. Most of
I am using SQL Azure as database with code first technique of Entity framework

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.