In Castle Activerecord (on top of NHibernate), is it possible to use class table inheritance globally and unidirectional inheritance of part of the inheritance tree? I would like to do something like
[ActiveRecord("model"), JoinedBase]
public abstract class Model: ActiveRecordBase
{
[PrimaryKey(PrimaryKeyType.UuidHex, "ROWID", Params = "format=D,separator=-")]
public virtual string Id { get; set; }
[Property("name")]
public string Name { get; set; }
[Property("description")]
public string Description{ get; set; }
}
[ActiveRecord("container")]
public class Container : Model
{
[JoinedKey("container_id")]
public override string Id
{
get { return base.Id; }
set { base.Id = value; }
}
}
[ActiveRecord("container",
DiscriminatorColumn = "container_type",
DiscriminatorValue = "1"
)]
public class Glass : Container
{
}
So, all common βthingsβ (like name, description, etc.) are in the βmodelβ table, but I can still use the STI in the βcontainerβ table. Or is it a waste of time and should I go for an STI for all this?
Thanks Jim
source
share