title: OData without database but with Foreign Keys
body: <p>I have an OData provider which doesn't use Entity Framework or any other sort of database.</p>
  
  <p>I use the following 2 models:</p>
  
  <pre><code>public class ItemModel : TrackableBaseModel&lt;Item&gt;
  {
      [Key]
      public Int32 ItemId { get; set; }
  
      public String ItemName { get; set; }
  
      public virtual ICollection&lt;ItemSerialModel&gt; ItemSerials { get; set; }
  }
  
  
  public class ItemSerialModel : TrackableBaseModel&lt;ItemSerial&gt;
  {
      public Int32 ItemSerialId { get; set; }
  
      [ForeignKey("Item")]
      public Int32? ItemId { get; set; }
  
      public ItemModel Item {get;set; }
  }
  </code></pre>
  
  <p>But the OData $metadata shows:</p>
  
  <pre><code>&lt;EntityType Name="ItemModel"&gt;
      &lt;Key&gt;
          &lt;PropertyRef Name="ItemId"/&gt;
      &lt;/Key&gt;
      &lt;Property Name="ItemId" Type="Edm.Int32" Nullable="false"/&gt;
      &lt;Property Name="ItemName" Type="Edm.String"/&gt;
      &lt;NavigationProperty Name="ItemSerials" Relationship="UserSite.Models.UserSite_Models_ItemModel_ItemSerials_UserSite_Models_ItemSerialModel_ItemSerialsPartner" ToRole="ItemSerials" FromRole="ItemSerialsPartner"/&gt;
  &lt;/EntityType&gt;
  &lt;EntityType Name="ItemSerialModel"&gt;
      &lt;Key&gt;
          &lt;PropertyRef Name="ItemSerialId"/&gt;
      &lt;/Key&gt;
      &lt;Property Name="ItemSerialId" Type="Edm.Int32" Nullable="false"/&gt;
      &lt;Property Name="ItemId" Type="Edm.Int32"/&gt;
      &lt;NavigationProperty Name="ItemModel" Relationship="UserSite.Models.UserSite_Models_ItemSerialModel_ItemModel_UserSite_Models_ItemModel_ItemModelPartner" ToRole="ItemModel" FromRole="ItemModelPartner"/&gt;
  &lt;/EntityType&gt;
  </code></pre>
  
  <p>But that doesn't make much sense, it comes with <code>ItemModelPartner</code> which doesn't even exist in the project.</p>
  
  <p>How can I setup manual FK's so that the navigation properties will work in OData?</p>
  
  <p>The WebApiConfig defines the models like this:</p>
  
  <pre><code>builder.EntitySet&lt;ItemModel&gt;("Items").EntityType.HasKey(x =&gt; x.ItemId);
  builder.EntitySet&lt;ItemSerialModel&gt;("ItemSerials").EntityType.HasKey(x =&gt; x.ItemSerialId);
  </code></pre>