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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:02:07+00:00 2026-05-21T03:02:07+00:00

I am still somewhat new to Linq to SQL. I am looking for a

  • 0

I am still somewhat new to Linq to SQL. I am looking for a way to get all members of an object by using a single linq query. The problem I haev run into is that one of the class members is a list of custom objects. It goes something like this:

Class:

public class RoomConfiguration
{
    public int ConfigID {get;set;}
    public string ConfigName { get; set; }
    public int RowCount { get; set; }
    public int ColCount { get; set; }
    public int FillDirection { get; set; }
    public string BigDoor { get; set; }
    public string SmallDoor { get; set; }
    public List<LineConfig> Lines { get; set; }
}

I am looking for a linq query that will fill in all of the members of this class, including Lines. The data for Lines comes from another table which I have defined a class for as well.

Thank you to anyone who may have a solution for this. Help is much appreciated!

  • 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-21T03:02:07+00:00Added an answer on May 21, 2026 at 3:02 am

    It’s a little hard, not knowing how your tables relate, but you could do this:

    var configs = db.RoomConfigurations
                    .Select( r => new RoomConfiguration
                     {
                         ConfigID = r.ConfigID,
                         ConfigName = r.ConfigName,
                         ...
                         Lines = db.LineConfigs
                                   .Where( l => l.RoomConfigID == r.ConfigID )
                                   .ToList()
                     });
    

    Or

    var configs = db.RoomConfigurations
                    .Join( db.LineConfigs, r => r.ConfigID, l => l.RoomConfigID, (r,l) => new { RoomConfig = r, LineConfigs = l } )
                    .GroupBy( j => j.RoomConfig )
                    .Select( g => new RoomConfiguration
                     {
                         ConfigID = g.Key.ConfigID,
                         ConfigName = g.Key.ConfigName,
                         ...
                         Lines = g.LineConfigs.ToList()
                     });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am still somewhat new to php and was wondering the best way to
After researching various hosts, I still get the feeling that it is somewhat impossible
still new to the world of linq, and i need some help flatening a
Still a bit new to Linq. This is driving me nuts. I want to
I'm still somewhat new to Java and trying to insert data into a database.
I have a SQL question that I could use some help with. Still somewhat
I'm new to Flex/Actionscript/FlashBuilder, and I don't quite get all the organization concepts. Our
So I am still somewhat new to PHP, MySQL, and Javascript but I have
I'm still somewhat new to WPF (only done a few small projects with it).
I'm still pretty new to programming so I have somewhat of a noob question.

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.