Example
I have Person, SpecialPerson, and User. Person and SpecialPerson are just people - they don\
This might not be what the OP meant to ask, but I thought I might throw this in here.
I recently had a unique case of db polymorphism in a project. We had between 60 to 120 possible classes, each with its own set of 30 to 40 unique attributes, and about 10 - 12 common attributes on all the classes . We decided to go the SQL-XML route and ended up with a single table. Something like :
PERSON (personid,persontype, name,address, phone, XMLOtherProperties)
containing all common properties as columns and then a big XML property bag. The ORM layer was then responsible for reading/writing the respective properties from the XMLOtherProperties. A bit like :
public string StrangeProperty
{
get { return XMLPropertyBag["StrangeProperty"];}
set { XMLPropertyBag["StrangeProperty"]= value;}
}
(we ended up mapping the xml column as a Hastable rather than a XML doc, but you can use whatever suits your DAL best)
It's not going to win any design awards, but it will work if you have a large (or unknown) number of possible classes. And in SQL2005 you can still use XPATH in your SQL queries to select rows based on some property that is stored as XML.. it's just a small performance penalty to take in.