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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:27:54+00:00 2026-05-11T03:27:54+00:00

I would like to know what the best practice for populating a business object

  • 0

I would like to know what the best practice for populating a business object hierarchy (parent/child/grandchild) structure is from a single database call.

I can think of a couple ways to accomplish it off the top of my head such as:

left-joining all the relations in my sql statement then use looping and logic to fill the business objects

or

use several select statements and 1 datareader and use its NextResult() method to iterate through each result set and fill the corresponding BO’s

Just wondering what the best practice for this is

I am using DAAB and c# for my DAL

Thanks!

  • 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. 2026-05-11T03:27:55+00:00Added an answer on May 11, 2026 at 3:27 am

    There is no universal recipe. It depends on database schema, database size and number of records your application reads in typical scenario. You have two processes here:

    • fetching data from database
    • populating business objects

    Fetching data from database is several magnitudes slower than creating objects in memory. Best way would be to construct select statements for fastest data access.

    Queries can be constructed in three ways:

    • one large query that fetches everything in single execution – you’ll get most complex SQL, and probably the fastest execution (depends on DB schema)
    • master/detail approach – simple queries. lots of traffic to database. This is acceptable only if you fetch small number of records, otherwise it is very slow.
    • hybrid: one query for each layer of hierarchy. Consider this approach if previous two methods are to slow. This approach requires more complex logic for populating business objects.

    You should decide which solution is acceptable. Some key points to consider:

    • which SQL is easier to create and maintain – one large that fetches everything in single read or several smaller.
    • when you choose on previous point, you should measure performance and make final decision
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know what is the best practice between using bind tag
I would like to know the best way to save an image from a
I would like to know the best way to delete records from a live
I would like to know what's the best technique to do single sign-on in
I would like to know the best practice about raising an exception without arguments.
I'm new to objective-c and would like to know the best practice for importing
I would like to know what's the best practice for setting up the distribution
I'm starting to learn Android and i would like know the best practice to
I am going to be using C/C++, and would like to know the best
I would like to know what would be the best way to do unit

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.