I am trying to come up with the "best" way to implement SQL Data Services flexible entity model where each class could be stored as an entity, even derrived classes.
Example: Every subclass has different
string Id
string Kind
Dictionary<string, object> Properties
So far, I'm heading in the direction of having both an Entity class (with above) and a base class that has some kind of collection like
Dictionary<string, Entity> data
And have each subclass add to that dictionary and just get/set properties like
data["EntityKind"].Properties["PropertyName"]
However, since each class only has ONE Entity, it seems like I should be using some sort of Stack (intead of Dictionary) where each level of the hierarchy knows exactly where it is. Then it occured to me that class inheritance IS the stack, so I thought maybe I was just missing some huge OO concept that would really simplify all of this. Something like
abstract eachsubclassmusthaveitsown Entity entity