title: When to add extend additional complex types onto a Breeze entity
body: <p>I want to load an entity from the database, and then using it's ICollection (from the model class) load up some child data.  This would be simple enough to do from individual view models if it was a 1 to many relationship, but I have a bit more complex structure - </p>
  
  <p>Parent has many children.  Each child has many grandchildren, that need to be linked back to the proper child.  The hierarchy needs to remain in tact.</p>
  
  <p>The other options that I have come up with so far may not be the best way so I my question is - what is the best practice to load up the grandchildren -  or some other method?</p>
  
  <p>in a constructor while configuring the metadataStore - </p>
  
  <pre><code>function configureMetadataStore(metadataStore) {
      metadataStore.registerEntityTypeCtor(
          'Child', null, childInitializer);
  }
  
  function childInitializer(child) {
      child.grandchildren = (Do something here)
          return grandchildren;
      });
  }
  </code></pre>
  
  <p>In the viewmodel where children are being populated - </p>
  
  <pre><code>function refresh() {
      return datacontext.getChildren(childs, parentId);
  }
  
  var addGrandChildren = function () {
      $.each(childs, function (i) {
          var grandChildren = ko.observableArray();
          var childId = $(this).data(id);
          datacontext.getGrandChildren(grandChildren, childId);
      });
      return;
  };
  </code></pre>
  
  <p>Or some other method?</p>