Specify way to load certain children explicitly

Issue #20 invalid
Jeremy Kolb created an issue

Is there a way to explicitly load children after the initial object is loaded?

My use case is: 1. Load initial object. 2. Lazily load specified child objects. 3. If we run out of memory I want to null those children so that I can repeat step 2 at a later date.

Comments (5)

  1. Jeremy Kolb reporter

    GetChildren returns all the children. How does one use GetChild to just return one child?

  2. Guillermo GutiƩrrez

    GetChildren doesn't 'return' the children, it loads them from database and assign them to the properties. GetChild does the same but only for the specified child, that seems to be what you're looking for:

    // Loads all the children of the object 'foo' from the database
    conn.GetChildren(foo);
    
    // Loads the child 'Bar' from the database
    conn.GetChild(f => f.Bar);  // Lambda version, compiler safe
    conn.GetChild("Bar"); // <-- Equivalent
    
  3. Log in to comment