I'm modelling a role-playing game and need to create the database schema for equipment. The data will be mostly static.
This article discusses three ways to model inheritance in a database: Table per Class Hierarchy, Table per Subclass, and Table per Concrete Class. Of the three, which would you recommend?
I did a sample Entity Framework 4.2 code-first solution to see what it came up with and it used the "Table per Class Hierarchy" method.
Here are the (simplified) classes:
public class Gear {
public int GearID { get; set; }
public string Name { get; set; }
}
public class Armor : Gear {
public int Kinetic { get; set; }
public int Energy { get; set; }
}
public class Weapon : Gear {
public int Damage { get; set; }
public int Range { get; set; }
}