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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:09:34+00:00 2026-05-15T11:09:34+00:00

I am using Linq-To-Sql to populate my business layer. Here is a snippet of

  • 0

I am using Linq-To-Sql to populate my business layer. Here is a snippet of a query I am working on:

fund.FundEntities = fundGroup.tFunds
    .Select(fe =>
    {
        var fundEntity = new FundEntity()
        {
            BankAccount = null,
            CloseDate = fe.closeDate ?? new DateTime(),
            Commitment = fe.commitment ?? 0,
            CommitmentEndDate = fe.closeDate ?? new DateTime(),
            Fund = fund
        };
        fundEntity.CapitalCalls = fe.tCapitalCalls
            .Select(cc =>
            {
                return new CapitalCall()
                {
                    Amount = cc.agrAmount ?? 0,
                    FundEntity = fundEntity
                };
            }
             );
        return fundEntity;
    });

When I run this code, it executes queries for individual CapitalCalls at runtime. Is there anyway I could re-architect this to keep the same business object structure (IE- the relations from Fund -> FundEntity -> CapitalCall within the business objects), but load full tables at a time? Ideally, there would be a single SQL query with lots of joins that would result in a fully populated Fund.

  • 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-15T11:09:35+00:00Added an answer on May 15, 2026 at 11:09 am
    var fund = GetFund();
    var fundGroup = GetFundGroup();
    var dataContest = GetDataContext();
    
    
    List<int> feIds = fundGroup.tFunds.Select(fe => fe.FundEntityId).ToList();
    
     //before: iterate through local collection fundGroup.tFunds
     //  and issue one CapitalCall query per fundEntity.
     //after: send all the fundEntityIds into the database in one query
     //  that also fetches related CapitalCalls.
    var query =
      from fe in dataContext.tFunds
      where feIds.Contains(fe.FundEntityId))
      let capitalCalls = fe.tCapitalCalls
      select new {FundEntity = fe, CapitalCalls = capitalCalls.ToList() };
    
    foreach(var record in query)
    {
      FundEntity fundEntity = new FundEntity()
      {
        CloseDate = record.fe.closeDate ?? new DateTime(),
        ...
      }
      fundEntity.CapitalCalls = ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to select all columns from tables in join using linq Sql: select CTRL_RUN_JOB.*,
I have started using Linq to SQL for a project im working on and
I'm using Linq to sql to populate my object. Previously, I was using deferred
I'm using linq to sql to populate a list of objects. One of the
I'm using a Linq DataContext.ExecuteQuery(some sql statement) to populate a list of objects var
I am using Linq To Sql to populate Html.DropDownLists in a few different forms
Using LINQ to SQL db.Products.Where(c => c.ID == 1).Skip(1).Take(1).ToList(); executes SELECT [t1].[ID], [t1].[CategoryID], [t1].[Name],
I'm writing a quick app using LINQ to SQL to populate a db with
Using Linq to SQL How does one query and match to include all rows
I am using Linq to SQl to query the data. When I write a

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.