Entity Framework Inheritance -
i interested in rather peculiar inheritance strategy , how implemented in entity framework 4.0. i've done reading around, i'm not sure of 3 standard solutions applicable (table-per-type, table-per-hierarchy, table-per-concrete-type).
i shall generalise problem easier one. let's have abstract base class entity b, , 2 derived entities d1 , d2.
now, d1 , d2 mapped onto separate defining queries - though share properties in common due shared base class b, these properties not pulled same place in storage.
all fine far, need able expose objectset<b>, i.e. collection unioning d1 , d2 items.
is possible?
thanks in advance help.
edit: here's more detail 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 xml format properly, d1 mapped onto defining query , d2 also. cannot map b onto anything, varies depending on subtype.
this bit of cheat, combine sets in database , pull entity framework? need create entity had properties , if property did not exist in b (i.e. in d1 or d2 only) have nullable.
Comments
Post a Comment