title: composite key as foreign key
body: <p>I am using Entity framework 4.1 in MVC 3 application. I have an entity where I have primary key consists of two columns ( composite key). And this is being used in another entity as foreign key. How to create the relationship ? In normal scnerios we use :</p>
  
  <pre><code>public class Category
  {
      public string CategoryId { get; set; }
      public string Name { get; set; }
  
      public virtual ICollection&lt;Product&gt; Products { get; set; }
  }
  
  public class Product
  {
      public int ProductId { get; set; }
      public string Name { get; set; }
      public string CategoryId { get; set; }
  
      public virtual Category Category { get; set; }
  } 
  </code></pre>
  
  <p>but what if category has two columns key ?</p>