title: NHibernate: Setting up references with IResultTransformer
body: <p>I have a custom class that implements IResultTransformer.</p>
  
  <p>It is easy to make this work for single values but what is the correct way to setup references if only the id is in the tuple? What if they are supposed to be lazy loaded? Should I just load them from the Session using the Get or Load methods?</p>
  
  <p>For example:</p>
  
  <pre><code>public class FoobarResultTransformer : IResultTransformer
  {
      public object TransformTuple(object[] tuple, string[] aliases)
      {
          var foobar = new Foobar();
  
          for (int i = 0; i &lt; aliases.Length; i++)
          {
              switch(aliases[i])
              {
                  case "IntProperty":
                      // This one is easy
                      foobar.IntProperty = Convert.ToInt32(tuple[i]);
                      break;
                  case "ReferencedEntityId":
                      // Assuming the tuple contains a GUID identifier, what should I do here?
                      foobar.ReferencedEntity =
                      break;
              }
          }
  
          return foobar;
      }
  }
  </code></pre>