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

The Archive Base Latest Questions

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

In a hierarchical data model i have Parent and Child. Parent has Fields[] and

  • 0

In a hierarchical data model i have Parent and Child. Parent has Fields[] and each child will also have the same “Count” of fields.. we’ll call them ChildField[]

public class Parent : ActiveRecordBase<Parent>
{
   [HasMany]
   IList<Field> Fields {get; set;}
   [HasMany]
   IList<Child> Children {get; set;}
}

public class Child : ActiveRecordBase<Child>
{
   [HasMany]
   IList<ChildField> ChildFields {get; set;}
}

Now when you don’t have any Fields inside Parent… but i have say 500 Child objects in its collection I sure dont want 500 selects (total) where each child tries to load its childField collection.

I suppose I can maybe do Lazy but at the same time.. when there are childFields I don’t want it lazy and eager is going to be more performant isn’t it?

ActiveRecordMediator might allow me to go something like

public void FetchByChild(Child child){    
child.Parent.Fields.Count > 0
       //Do the fetch
    else
       //return;
}

Does the mediator serve the purpose to “skip” db calls when additional knowledge of the “calling-context” is provided?

  • 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-13T10:09:15+00:00Added an answer on May 13, 2026 at 10:09 am

    The question is a bit confusing… ActiveRecordMediator is only a NHibernate ISession accessor. It can’t skip queries or anything like that. It only executes the queries that you feed it.

    In NHibernate (and ActiveRecord of course) you can use lazy or eager fetching on a per-query basis. That is, if for a particular query you know you’ll need those Child entities you can fetch them eagerly. If you don’t, let them be lazy.

    These articles are a great introduction to lazy/eager loading:

    • http://nhforge.org/wikis/howtonh/lazy-loading-eager-loading.aspx
    • http://www.castleproject.org/activerecord/documentation/trunk/advanced/tuning.html

    There are also other perf tweaks you can do, like batch fetching for collections

    If you meant setting your fetch strategy from an external context, see these articles:

    • http://www.udidahan.com/2007/04/23/fetching-strategy-design/
    • http://www.udidahan.com/2007/09/16/fetching-strategy-nhibernate-implementation-available/
    • http://ayende.com/Blog/archive/2008/03/27/Adaptive-Domain-Models-with-Rhino-Commons.aspx
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some hierarchical data - each entry has an id and a (nullable)
My VB.Net Winforms app is a tool to allow hierarchical data to be edited
How do you build a hierarchical set of tags with data in PHP? For
I'm creating an application that will store a hierarchical collection of items in an
What are the ways that you use to model and retrieve hierarchical info in
Are there any algorithms that can help with hierarchical clustering? Google's map-reduce has only
Delphi 2009 introduced a hierarchical system for project options configuration, where you set base
Is there any Java library that supports hierarchical column? For example (the first three
What do you think is the best way to present a hierarchical list of
I am trying to come up with the best way to render some hierarchical

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.