title: Breeze 1.4.6 + Web API 2 OData - Navigation properties missing
body: <p>I'm trying to use the latest version of Breeze at the time of writing (1.4.6) with Web API 2 (ODataController).  My problem is that the result from Breeze is missing navigation properties.</p>
  
  <p>Consider the following:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public class Country : EntityBase&lt;long&gt;
  {
      public Country()
      {
          Provinces = new List&lt;Province&gt;();
      }
  
      [Required]
      [StringLength(256)]
      public string Name { get; set; }
  
      [Required]
      [StringLength(3)]
      public string Abbreviation { get; set; }
  
      // Navigation Properties
  
      [InverseProperty("Country")]
      public virtual ICollection&lt;Province&gt; Provinces { get; set; }
  }
  
  public class Province : EntityBase&lt;long&gt;
  {
      [Required]
      [StringLength(256)]
      public string Name { get; set; }
  
      [Required]
      [StringLength(3)]
      public string Abbreviation { get; set; }
  
      public long CountryId { get; set; }
  
      [ForeignKey("CountryId")]
      [InverseProperty("Provinces")]
      public virtual Country Country { get; set; }
  }
  </code></pre>
  
  <p>I then scaffolded out an ODataController for Country using VS 2013 and made sure my WebApiConfig was updated correctly:</p>
  
  <pre class="lang-cs prettyprint-override"><code>var builder = new ODataConventionModelBuilder();
  builder.EntitySet&lt;Country&gt;("Countries");
  builder.EntitySet&lt;Province&gt;("Provinces");
  builder.Namespace = "MyNamespace.Models";
  
  var batchHandler = new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer);
  config.Routes.MapODataRoute("odata", "odata", builder.GetEdmModel(), batchHandler);
  </code></pre>
  
  <p>At this point I'm able to run queries successfully against my data.</p>
  
  <p><a href="http://mysite.local/Api/odata/Countries" rel="nofollow">http://mysite.local/Api/odata/Countries</a>?$expand=Provinces</p>
  
  <p>This returns what you would expect:</p>
  
  <pre><code> {
    "odata.metadata":"http://mysite.local/Api/odata/$metadata#Countries","value":[
      {
        "Provinces":[
          {
            "Name":"Alberta","Abbreviation":"AB","CountryId":"1","Id":"1"
          },{
            "Name":"British Columbia","Abbreviation":"BC","CountryId":"1","Id":"2"
          },{
            "Name":"Manitoba","Abbreviation":"MB","CountryId":"1","Id":"3"
          },{
            "Name":"New Brunswick","Abbreviation":"NB","CountryId":"1","Id":"4"
          }
          // edited for brevity
        ],"Name":"Canada","Abbreviation":"CA","Id":"1"
    }
  }
  </code></pre>
  
  <p>Now I'm ready to start consuming this data on the client.  I hooked up datajs/Breeze and configured breeze to use OData.  Here's what I'm using to configure and create the breeze manager:</p>
  
  <pre><code>    function configureBreezeManager() {
          breeze.config.initializeAdapterInstances({
              dataService: 'OData'
          });
          breeze.NamingConvention.camelCase.setAsDefault();
          var mgr = new breeze.EntityManager('http://mysite.local/api/odata');
          return mgr;
      }
  </code></pre>
  
  <p>Then I tried to do a simple query:</p>
  
  <pre><code>var query = breeze.EntityQuery.from('Countries').expand('Province').orderBy('name');
  </code></pre>
  
  <p>This query succeeds and I get a result with a couple country objects (Canada &amp; US) but it is missing navigation properties for Provinces. The other data (id, name, abbreviation) are all present as expected.  I also tried the inverse of this and queried Provinces and expanded Country and got the same result (no navigation properties).</p>
  
  <p>I can see that Breeze is correctly appending $expand and the request url is what I would expect.</p>
  
  <p>I've read that OData is missing foreign key information that Breeze requires but Breeze 1.4.4 added support for OData v3 so I'm not sure if this should be working or not?</p>
  
  <p>Thanks.</p>
  
  <p>Edit: Here is the generated metadata in case it helps:</p>
  
  <pre><code>&lt;edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" Version="1.0"&gt;
    &lt;edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="3.0" m:MaxDataServiceVersion="3.0"&gt;
      &lt;Schema xmlns="http://schemas.microsoft.com/ado/2009/11/edm" Namespace="MyNamespace.Models"&gt;
        &lt;EntityType Name="Country"&gt;
          &lt;Key&gt;
            &lt;PropertyRef Name="Id"/&gt;
          &lt;/Key&gt;
          &lt;Property Name="Name" Type="Edm.String" Nullable="false"/&gt;
          &lt;Property Name="Abbreviation" Type="Edm.String" Nullable="false"/&gt;
          &lt;Property Name="Id" Type="Edm.Int64" Nullable="false"/&gt;
          &lt;NavigationProperty Name="Provinces" Relationship="MyNamespace.Models.MyNamespace_Models_Country_Provinces_MyNamespace_Models_Province_ProvincesPartner" ToRole="Provinces" FromRole="ProvincesPartner"/&gt;
        &lt;/EntityType&gt;
        &lt;EntityType Name="Province"&gt;
          &lt;Key&gt;
            &lt;PropertyRef Name="Id"/&gt;
          &lt;/Key&gt;
          &lt;Property Name="Name" Type="Edm.String" Nullable="false"/&gt;
          &lt;Property Name="Abbreviation" Type="Edm.String" Nullable="false"/&gt;
          &lt;Property Name="CountryId" Type="Edm.Int64" Nullable="false"/&gt;
          &lt;Property Name="Id" Type="Edm.Int64" Nullable="false"/&gt;
          &lt;NavigationProperty Name="Country" Relationship="MyNamespace.Models.MyNamespace_Models_Province_Country_MyNamespace_Models_Country_CountryPartner" ToRole="Country" FromRole="CountryPartner"/&gt;
        &lt;/EntityType&gt;
        &lt;Association Name="MyNamespace_Models_Country_Provinces_MyNamespace_Models_Province_ProvincesPartner"&gt;
          &lt;End Type="MyNamespace.Models.Province" Role="Provinces" Multiplicity="*"/&gt;
          &lt;End Type="MyNamespace.Models.Country" Role="ProvincesPartner" Multiplicity="0..1"/&gt;
        &lt;/Association&gt;
        &lt;Association Name="MyNamespace_Models_Province_Country_MyNamespace_Models_Country_CountryPartner"&gt;
          &lt;End Type="MyNamespace.Models.Country" Role="Country" Multiplicity="0..1"/&gt;
          &lt;End Type="MyNamespace.Models.Province" Role="CountryPartner" Multiplicity="0..1"/&gt;
        &lt;/Association&gt;
        &lt;EntityContainer Name="Container" m:IsDefaultEntityContainer="true"&gt;
          &lt;EntitySet Name="Countries" EntityType="MyNamespace.Models.Country"/&gt;
          &lt;EntitySet Name="Provinces" EntityType="MyNamespace.Models.Province"/&gt;
          &lt;AssociationSet Name="MyNamespace_Models_Country_Provinces_MyNamespace_Models_Province_ProvincesPartnerSet" Association="MyNamespace.Models.MyNamespace_Models_Country_Provinces_MyNamespace_Models_Province_ProvincesPartner"&gt;
            &lt;End Role="ProvincesPartner" EntitySet="Countries"/&gt;
            &lt;End Role="Provinces" EntitySet="Provinces"/&gt;
          &lt;/AssociationSet&gt;
          &lt;AssociationSet Name="MyNamespace_Models_Province_Country_MyNamespace_Models_Country_CountryPartnerSet" Association="MyNamespace.Models.MyNamespace_Models_Province_Country_MyNamespace_Models_Country_CountryPartner"&gt;
            &lt;End Role="CountryPartner" EntitySet="Provinces"/&gt;
            &lt;End Role="Country" EntitySet="Countries"/&gt;
          &lt;/AssociationSet&gt;
        &lt;/EntityContainer&gt;
      &lt;/Schema&gt;
    &lt;/edmx:DataServices&gt;
  &lt;/edmx:Edmx&gt;
  </code></pre>