title: How do I specify table for foreign key in entity framework?
body: <p>All examples in tutorials I have read through only ever show 2 tables so I am confused on what to do in the following scenario.</p>
  
  <p>Lets say we have 3 classes:</p>
  
  <pre><code>public class Product
      {
          public int id { get; set; }
          public string name { get; set; }
          public string skuA { get; set; }
          public string skuB { get; set; }
  
          public virtual SupplierA supplierA { get; set; }
          public virtual SupplierB supplierB { get; set; }
      }
  public class Supplier A
      {
          public int id { get; set; }
          public string name { get; set; }
          public string sku { get; set; }
          public int price { get; set; }
      }
  public class Supplier B
      {
          public int id { get; set; }
          public string name { get; set; }
          public string sku { get; set; }
          public int price { get; set; }
      }
  </code></pre>
  
  <p>If we need to join the appropriate product sku field then using the data annotation I have seen in tutorial it ends up looking like this:</p>
  
  <pre><code>[ForeignKey("sku")]
  public string skuA { get; set; }
  [ForeignKey("sku")]
  public string skuB { get; set; }
  </code></pre>
  
  <p>How does entity framework know which foreign "sku" field we are annotating for? Does each foreign key have to be named differently?  I imagine this would become awkward if we had a hundred suppliers.</p>
  
  <p>Are there some additional parameters or markup to handle this?  Any advice appreciated as I am finding this confusing.</p>