title: Mapping composite foreign key to composite primary key where the foreign key is also a primary key
body: <p>I want to make VM_hostname,datetime and name properties as a composite Key for <strong>Disk class</strong> . At the same time VM_hostname and datetime of <strong>Disk class</strong> should refer to VM_hostname and datetime of <strong>VirtualMachine</strong> class (ie Foreign keys) . </p>
  
  <p>I did this but it gives me this exception :
  The ForeignKeyAttribute on property 'datetime' on type 'WebJob1.Historical.Disk' is not valid. The navigation property 'Datetime' was not found on the dependent type 'WebJob1.Historical.Disk'. The Name value should be a valid navigation property name</p>
  
  <p>Anyone have a clue ? Also, please note that im using Data Annotation. </p>
  
  <pre><code>public class VirtualMachine
  {
  
      [Key]
      [Column(Order = 0)]
      public string VM_Hostname { get; set; }
      [Key]
      [Column(Order = 1)]
      public DateTime Datetime;
      public virtual List&lt;Disk&gt; disks { get; set; }
  }
  
   public class Disk
  {
      [Key,ForeignKey("VirtualMachine"),Column(Order = 0)]
      public string VM_hostname { get; set; }
      [Key,ForeignKey("Datetime"), Column(Order = 1)]
      public DateTime datetime { get; set; }
      [Key, Column(Order = 2)]
      public string name { get; set; }
  
      public virtual VirtualMachine VirtualMachine{ get; set; }
  
  
  }
  </code></pre>