title: Handling references in breezejs
body: <p>We are developing a single page app using ASP.NET MVC4 with Web Api + Ko + Breeze using EF Code First.</p>
  
  <p>Our (simplified) data model looks like this</p>
  
  <pre><code>class Product {
      public String Name { get; set; }
      public ICollection&lt;ImageCollection&gt; ImageSets { get; set;}
      public Image DefaultImage { get; set; }
  }
  
  class ImageCollection {
      public ICollection&lt;Image&gt; Images { get; set; }
  }
  
  class Image {
      public String ImageUrl { get; set; }
  }
  </code></pre>
  
  <p>DefaultImage is a navigation property (with foreign key) and is one of the images in the ImageSets.</p>
  
  <p>We are exposing a Web API method of Products() and with default Breeze configuration. JSON serialized output on the wire has references for objects (i.e., PreserveReferencesHandling.Object) so when I want to bind the ImageUrl ko is unable to resolve the value.</p>
  
  <p>Html looks like this</p>
  
  <pre><code> &lt;img data-bind="attr: { src: DefaultImage().ImageUrl, title: Name}" /&gt;
  </code></pre>
  
  <p>When I switch the serializer to do PreserveReferencesHandling.None, the binding works.</p>
  
  <p>Question: how do I make the default config to work? or if I switch to PreserveReferencesHandling.None for Breeze what are the gotchas/downsides?</p>
  
  <p>Thanks!</p>