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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:28:40+00:00 2026-06-04T09:28:40+00:00

Apologies for the clunky title. I need to query a collection and return the

  • 0

Apologies for the clunky title. I need to query a collection and return the grandparent, parent and grandchild based on a grandchild’s property

For example with the object below, I want to get the Quote, the Rate (Parent) and the Plan (GrandChild) only if a condition matches the Plan’s ID.

public class Quote
{
    public int Id { get; set; }
    public string Type { get; set; }
    public string ParentType { get; set; }
    public decimal ValueMax { get; set; }
    public virtual ICollection<Rate> Rates { get; set; }
}

public class Rate
{
    public int Id { get; set; }
    public decimal ValueMax { get; set; }
    public ICollection<Plan> Plans { get; set; }
}

public class Plan

    public int Id { get; set; }
    public decimal Price { get; set; }
}
  • 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-04T09:28:41+00:00Added an answer on June 4, 2026 at 9:28 am

    You should be able to do something like this to get the plans which meet whatever criteria, along with their parent and grandparent objects:

    // results is an anonymous type with properties Quote, Rate, Plan
    var results = from q in quotes
        from r in q.Rates
        from p in r.Plans
        where p.Id < 500 /* whatever criteria */
        select new 
        {
            Quote = q,
            Rate = r,
            Plan = p
        };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Apologies for the long winded title but looking for a solution to what might
Apologies if the title above is a little convoluted, writing these things in plain
Apologies for the horrible title. I spent 10 minutes trying to explain this in
Apologies if the Topic title isn't accurate, I didn't really know how to express
Apologies for the fairly ambiguous title but what I'm trying to achieve is probably
Apologies if this has been asked before. I have some data which I need
Apologies for the horrible title but I've no idea how to describe this easily.
Apologies for vague title as i couldn't think what the name is. Basically creating
Apologies for the title, I found it hard to define my question succintly and
Apologies if the title is not clear, I' not really sure how to explain

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.