Is there any way to map a polymorphic (<subclass>) component in v1.2.0GA?
My object model is like this:
Code:
public class DomainClass
{
private IStrategy _myStrategy;
private int _classSpecificState;
public int ClassSpecificState
{
get { return _classSpecificState; }
}
public decimal StrategyState
{
get { return _myStrategy.SomeState; }
}
public void StrategyBehaviour()
{
_myStrategy.SomeBehaviour();
}
}
public interface IStrategy
{
decimal SomeState{ get;}
void SomeBehaviour();
}
public class StrategyOne : IStrategy
{
private decimal _someState;
#region IStrategy Members
public decimal SomeState
{
get { return _someState; }
}
public void SomeBehaviour()
{
throw new NotImplementedException();
}
#endregion
}
public class StrategyTwo : IStrategy
{
#region IStrategy Members
public decimal SomeState
{
get { return 0m; }
}
public void SomeBehaviour()
{
throw new NotImplementedException();
}
#endregion
}
I would like to contain both the DomainClass (& it's associated IStrategy) within the one table. However to do this I would need some way specifying a
polymorphic component in my DomainClass hbm file.
Is there any way to do this?