title: ASP.Net WebAPI JSON response does not serialize entity relationships
body: <p>I'm developing an ASP.Net MVC5 application using Web API 5, OData and Entity Framework 6. I've created Repositories and used Entity Framework Power Tools to generate my entity models. I've turned OFF lazy loading and proxy generation on my DBContext. Below is how i'm writing my LINQ queries in repository classes to return entities with relationships;</p>
  
  <pre><code>           return repository
              .Query(i =&gt; i.IsTransaction == true)
              .Include(i =&gt; i.SubInventory)
              .Include(c =&gt; c.Contact)                
              .OrderBy(q =&gt; q
                  .OrderBy(i =&gt; i.ItemFullCode))                
              .Select();
  </code></pre>
  
  <p>Further in my ODataConfig file I've set;</p>
  
  <pre><code>config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling
              = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
  
  config.Formatters.JsonFormatter.SerializerSettings.PreserveReferencesHandling
              = Newtonsoft.Json.PreserveReferencesHandling.Objects;
  </code></pre>
  
  <p>The issue that I'm struggling with is that my Web API method JSON response does NOT contain relationships which are Included in LINQ query but just the main entity data. Any idea what I'm missing here?</p>
  
  <p>Below is the code of my main entity.</p>
  
  <pre><code>    public partial class Item : Entity
  {
      public Item()
      {
          this.DocumentDatas = new List&lt;DocumentData&gt;();
          this.ItemColorSizes = new List&lt;ItemColorSize&gt;();
          this.ItemPrices = new List&lt;ItemPrice&gt;();
          this.Items1 = new List&lt;Item&gt;();
          this.ItemStocks = new List&lt;ItemStock&gt;();
          this.SeasonalSaleDetails = new List&lt;SeasonalSaleDetail&gt;();
      }
  
      public string ItemFullCode { get; set; }
      public string ItemCode { get; set; }
      public string ItemName { get; set; }
      public string ItemShortCode { get; set; }
      public string LevelItemFullCode { get; set; }
      public string SupplierCode { get; set; }
      public string SubInvCode { get; set; }
      public Nullable&lt;decimal&gt; PurchasePrice { get; set; }
      public Nullable&lt;decimal&gt; SalePrice { get; set; }
      public Nullable&lt;System.DateTime&gt; ArrivalDate { get; set; }
      public string RefCode { get; set; }
      public Nullable&lt;decimal&gt; TColumn { get; set; }
      public Nullable&lt;bool&gt; TColumnByAmt { get; set; }
      public Nullable&lt;bool&gt; IsGiftItem { get; set; }
      public Nullable&lt;bool&gt; IsTransaction { get; set; }
      public Nullable&lt;bool&gt; IsActive { get; set; }
      public string CreatedBy { get; set; }
      public Nullable&lt;System.DateTime&gt; CreatedDate { get; set; }
      public string ModifiedBy { get; set; }
      public Nullable&lt;System.DateTime&gt; ModifiedDate { get; set; }
      public Contact Contact { get; set; }
      public ICollection&lt;DocumentData&gt; DocumentDatas { get; set; }
      public ICollection&lt;ItemColorSize&gt; ItemColorSizes { get; set; }
      public ICollection&lt;ItemPrice&gt; ItemPrices { get; set; }
      public ICollection&lt;Item&gt; Items1 { get; set; }
      public Item Item1 { get; set; }
      public SubInventory SubInventory { get; set; }
      public ICollection&lt;ItemStock&gt; ItemStocks { get; set; }
      public ICollection&lt;SeasonalSaleDetail&gt; SeasonalSaleDetails { get; set; }
  }
  </code></pre>