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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:15:48+00:00 2026-05-19T12:15:48+00:00

Not sure what the best title would be for this question, or even if

  • 0

Not sure what the best title would be for this question, or even if I am being clear, but here it is:

What is the best way to setup complex objects so as to not have to retrieve the entire object graph when the parent object is first being accessed?

For example:
Order

  • has a customer

  • order lines (many)

    • product

      • price
    • pricing details (discounts, etc)

    • order status

  • status

  • fulfilment date

Would you create the Order with all its dependent objects as properties or would you provide accessor method for the dependent objects?

example:

Option 1:

class Order

  • public property Customer

  • public property List of Order Lines

Option 2:

class Order

- public GetCustomer():Customer

- public GetOrderLines():List of order lines

The way I see it each has its own advantages and disadvantages:

Option 1: Class diagrams show the relationship between different objects. The disadvantage is that when you are getting the Order object, you need to get the entire object graph (which could get expensive and in many cases might be unnecessary).

Option 2: Because each object is retrieved through a Get call, you can defer the actual retrieval to when the object is needed. Disadvantage, at least in Visual Studio class diagrams, you can no longer get nice relationships between the different objects.

Are there any other design patterns that can accomplish what I am trying more efficiently?

  • 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-19T12:15:48+00:00Added an answer on May 19, 2026 at 12:15 pm

    Would you consider using an ORM such as Entity Framework or NHibernate? That way, you’ll get Lazy Loading support without having to go through a lot of trouble implementing it yourself.

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

Sidebar

Related Questions

I'm not the sure title of this question is the best, but hopefully this
I'm not quite sure the best way to deal with this situation. Here's a
So I'm not sure what the best way to accomplish this is, but basically
I'm not sure this question has the best of titles but I'm not sure
So I'm not exactly sure if the title fits it best, but here's what
As you can probably tell by the title, I'm not sure the best way
for sure this is not the best title. I'm creating a system to generate
I am sure the title of my question doesn't make much sense. But here
NOTE: I am not exactly sure how to title or tag this question, so
Not sure if that was the best Title in the world but I hope

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.