I found another post on creating my own UserType
http://www.lostechies.com/blogs/rhousto ... rtype.aspx
My Entity can be nice and POCO now:
public class Order
{
private IShipping _ShippingStrategy;
private int _OrderID;
public Order()
{ }
public int OrderID
{
get { return _OrderID; }
set { _OrderID = value; }
}
public IShipping Shipping
{
get { return _ShippingStrategy; }
set { _ShippingStrategy = value; }
}
}
and the mapping file is nice and straightforward:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Order" assembly="OrderTest.Model">
<class name="OrderTest.Model.Order" table="Order" lazy="false">
<id name="ID" column="id" type="Int32" unsaved-value="0">
<generator class="native" />
</id>
<property name="Shipping" type="OrderTest.Infrastructure.Repositories.ShippingMapper, OrderTest.Infrastructure.Repositories" column="Shipping" not-null="true" />
</class>
</hibernate-mapping>
With the ShippingMapper doing all the dirty work.