We are making an EntityFramework CodeFirst DAL over a legacy database (which means that we are mostly stuck with whatever design errors it has).
Domain model is (pretty) simple: we have abstract Card, subtyped into HomeCard, CarCard, OwnerCard and RenterCard. To be precise:
abstract class Card {}
class HomeCard: Card {}
class CarCard: Card {}
class OwnerCard: Card {}
class RenterCard: Card {}
Database model follows it with tables Cards, Homes, Cars, Owners and Renters, where Cards contains common columns, and other tables contain columns pertaining to specific class. Which is exactly what TPT means, and it maps perfectly to EntityFramework.
After refactoring we've found that (not unexpectedly) Home and Car do share some properties, and Owner and Renter do the same. And it is not only for the sake of beauty, but some functionality would be much easier to implement (e.g. searching Owners and Renters by name, or Homes and Cards by owner). So we expect our domain model to look like this:
abstract class Card {}
abstract class ProperyCard: Card {}
class HomeCard: ProperyCard {}
class CarCard: ProperyCard {}
abstract class PersonCard: Card {}
class OwnerCard: PersonCard {}
class RenterCard: PersonCard {}
But we still have the same db model, which means that we have some weird mix between TPT and TPC. All our attempts to map it via EF/CodeFirst have failed. Any advice on making it work?
PS Our base table, Cards, does have a discriminator field, if that could be of any help.