title: Entity Framework with interfaces does not work - what the best way to handle the same?
body: <p>I am using <a href="http://en.wikipedia.org/wiki/ADO.NET_Entity_Framework" rel="nofollow">Entity Framework</a> and would like to use TPH with interfaces. So I have a created an interface, "ICustomer", which maps to "SimpleCustomer" and "DiscountedCustomer" class as shown below. Below is the model builder code. From what I understand we can not use interfaces with Entity Framework, so what's the best way?</p>
  
  <pre><code> modelBuilder.Entity&lt;ICustomer&gt;().ToTable("tblCustomer")
  .Map&lt;SimpleCustomer&gt;(x =&gt; x.Requires("CustomerType").HasValue("S"))
  .Map&lt;DiscountedCustomer&gt;(x =&gt; x.Requires("CustomerType").HasValue("D"));
  </code></pre>
  
  <p>My application uses interfaces all over the UI and would like to have a smooth type casting to Entity Framework. So is what the best way?</p>