, , - :
, , NH ( SQL), . FluentNH:
public enum CustomerType
{
Customer,
TierOneCustomer
}
public class Customer
{
public virtual CustomerType Type
{
get {return CustomerType.Customer;}
set {}
}
...
}
public class TierOneCustomer:Customer
{
public override CustomerType Type {get {return CustomerType.TierOneCustomer;} set{}}
...
}
public class CustomerMap:ClassMap<Customer>
{
public CustomerMap()
{
...
DiscriminateSubClassesOnColumn<string>("CustomerType");
DiscriminatorValue(CustomerType.Customer.ToString());
Map(x => x.Type).Column("CustomerType").Update().Not.Insert();
}
}
public class TierOneCustomerMap:SubclassMap<TierOneCustomer>
{
public CustomerMap()
{
...
DiscriminatorValue(CustomerType.TierOneCustomer.ToString());
...
}
}
, - , , ( un - ), , . , AFAIK NHibernate , (, , " " ); NHibernate, - , ?
, "", , "" ( "" ). " " / .., , , OP. OP TierOneCustomer -, , .