I need to create a custom type for NHibernate by writing a new mapper class that implements IUserType
. While it is relatively straightforward to override most of the methods and properties, I get some difficulties to understand how to deal correctly with the following members:
object Assemble(object cached, object owner);
object DeepCopy(object value);
object Disassemble(object value);
object Replace(object original, object target, object owner);
I do not understand what is exactly their purpose; and more important, how to properly implement them. Most of the examples I have seen just return the raw input parameter.
public object DeepCopy(object value)
{
return value;
}
public object Replace(object original, object target, object owner)
{
return original;
}
public object Assemble(object cached, object owner)
{
return cached;
}
public object Disassemble(object value)
{
return value;
}
How to implement those methods correctly in a real case or more complex scenario?