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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:46:07+00:00 2026-05-27T11:46:07+00:00

Here are my classes : class PriceScale -int ID -float bookingFees -Product product -List<PricePeriod>

  • 0

Here are my classes :

class PriceScale
-int ID
-float bookingFees
-Product product
-List<PricePeriod> periods

Class Product
-int ID
-string name
-List<PriceScale> priceScales

class PricePeriod
-DateTime begin
-DateTime end
-float price
-PriceScale scale

As you can see I strictly applied business rules “A product as many price scales, and a price scale has many period”.

My problem : for instance when I’m dealing with the Product class I don’t like to ask myself “Is the priceScales loaded ?” (cause I won’t load it every time I need a product)

Solution :

1/ Lazy loading : I don’t like it, cause you run sql query without even knowing it, and you can end up with a 1+n query problem (I’m working on the price computing system so I really need to be sure of which sql query is executed)

2/ Always load it : I don’t like it, cause if I apply this logic to everything I’ll end up loading the whole database.

3/ Remove the composition (ie the member priceScales),in that case what is the best way to deal with price scale :

  • get a Dictionnary<int,List<PriceScales>> where the key is the product id ?

  • something else ?

4/ Add at the beginning of my method where I need the priceScales

checkPriceScalesAreLoaded(productList);

It looks like lazy loading, but it’s more explicit.

5/ Something else I didn’t even think about 🙂

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. Editorial Team
    Editorial Team
    2026-05-27T11:46:07+00:00Added an answer on May 27, 2026 at 11:46 am

    I decided to make multiple result set queries like here

    http://vb.net-informations.com/ado.net-dataproviders/ado.net-multiple-result-sets.htm

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

Sidebar

Related Questions

Here are my classes public class Activity { public int ID {get;set;} public string
Here are my classes: public class XDetail { public string Name { get; set;
Here two of my model classes: class DashboardVersion(models.Model): name = models.CharField(_(Dashboard name),max_length=100) description =
Here are my classes: public class User { public virtual int Id { get;
I'm having troubles finding a class name after extending other classes. Here are the
I have the following classes: class Person { public string Name { get; set;
Here's an example: If I have these classes class Author(models.Model): name = models.CharField(max_length=45) class
i have the following (simplified) domain classes class Filter { String name static hasMany
Here are my classes: public class A { public int archive {get; set;} }
I have these two classes: class Student { String name; String age ; }

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.