title: Entity framework inheritance
body: <p>I'll try to explain the problem I'm currently facing as simply as possible.
  The project I'm currently working on is required to analyze some financial data. For convenience, this data should be stored in a database, so I'm tasked with creating a database model. While the database wasn't required up until now, the application itself has been developed for a number of years and already has all the data types and classes defined, so my task is to match the database model to the classes used by application. Here's a simplified breakdown of a class composition used by application to work with the data.
  <br/>
  To start with, there's an abstract Entry class that all other financial data entries are inherited from:</p>
  
  <pre><code>abstract class Entry
  {
      public Guid ID { get; set; }
      public string Name { get; set; }
  }
  </code></pre>
  
  <p>Different financial data comes in different formats an is relevant to different points in time. To reflect this, there's a number of interfaces that are implemented by concrete data types. As an example, lets say that all the data can either be relative to a certain point in time or a period in time. Take currency rate for example. It only changes once a day. GDP, on the other hand, is usually provided for a certain period (either quarterly or yearly). This is reflected by the classes provided below.</p>
  
  <pre><code>class SingleDateEntry : Entry
  {
      public DateTime Date { get; set; }
  }
  
  class PeriodEntry : Entry
  {
      public DateTime PeriodStart { get; set; }
      public DateTime PeriodEnd { get; set; }
  }
  </code></pre>
  
  <p>Furthermore, the data can be represented in different formats. Some data only has a single value, like the currency rate for example, other data can come in data sets, like daily stock prices, which have an opening and closing daily prices, as well as maximum and minimum daily prices.</p>
  
  <pre><code>interface ISingleValueEntry
  {
      public double Value { get; set; }
  }
  
  interface IMinMaxEntry
  {
      public double MinPrice { get; set; }
      public double MaxPrice { get; set; }
  }
  
  interface IOpenCloseEntry
  {
      public double OpenPrice{get;set;}
      public double ClosePrice{get;set;}
  }
  </code></pre>
  
  <p>As an example, the daily currency rate, since it is associated with a single day in the past and only has one value, could be represented by a class that looks like this:</p>
  
  <pre><code>class DailyCurrencyRate : SingleDateEntry, ISingleValueEntry
  {
  }
  </code></pre>
  
  <p>The stock prices have a number of different values associated with them, so they can be represented like this:</p>
  
  <pre><code>class DailyStockPrice : SingleDateEntry, IOpenCloseEntry, IMinMaxEntry
  {
  }
  </code></pre>
  
  <p>And finally, GDP, since it is associated with a period in time and has a single value, would look like this:</p>
  
  <pre><code>class GDP : PeriodEntry, ISingleValueEntry
  {
  }
  </code></pre>
  
  <p>Unfortunately, I haven't worked with EF before, and when I tried to implement this simplified scenario of the actual problem I've run into a number of problems, so I would appreciate any suggestions that could help me out resolving them.
  <br/>
  To start with, how to deal with multiple interface implementations? As far as I know EF doesn't support multiple inheritance, and by using associations, I don't get classes that implement them, rather it generates classes that contain references to objects that implement these interfaces, which is bad, since it doesn't matches the interface expected by the application. Furthermore, what type of inheritance should be used it this scenario? From what I understood after my research, TPC would be a better strategy, but I might be wrong about that.
  <br/>
  Thanks in advance for any pointers, suggestions and "gotchas".</p>