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 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 sure how to put this best into a title, but this is
I find this comes up a lot, and I'm not sure the best way
This should be easy, but I'm not sure how to best go about it.
Not sure if the title is quite right for the question but I can't
I've got a situation here and I'm not sure what the best way of
I am thinking on the following approach but not sure if its the best
Not sure how to ask a followup on SO, but this is in reference
Not sure what exactly is going on here, but seems like in .NET 1.1
I'm not sure what the best api for simple 2d graphics with Java is.
I am not sure where the best place to put validation (using the Enterprise

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.