I am interested in a rather peculiar inheritance strategy and how it could be implemented in Entity Framework 4.0. I've done some reading around, but I'm not sure that any of the three standard solutions are applicable (table-per-type, table-per-hierarchy, table-per-concrete-type).
I shall generalise my problem into an easier one. Let's say I have an abstract base class entity B, and two derived entities D1 and D2.
Now, D1 and D2 are mapped onto separate defining queries - even though they share properties in common due to their shared base class B, these properties are not pulled from the same place in the storage.
All is fine so far, but I really need to be able to expose an ObjectSet<B>, i.e. a collection unioning D1 and D2 items.
Is this possible?
Thanks in advance for any help.
EDIT: Here's some more detail as requested.
Entity POCOs
public abstract class B {
public int ID { get; set; }
public DateTime SomeDate { get; set; }
}
public sealed class D1 : B {
public string SomeInfo { get; set; }
}
public sealed class D2 : B {
public decimal SomeNumber { get; set; }
}
I can't get the XML to format properly, but basically D1 is mapped onto a defining query and D2 is also. I cannot map B onto anything, as it varies depending on the subtype.