Tag: ncommon

如何正确实现IUserType?

我需要通过编写一个实现IUserType的新mapper类来为NHibernate创建一个自定义类型 。 虽然覆盖大多数方法和属性相对简单,但我理解如何正确处理以下成员会遇到一些困难: object Assemble(object cached, object owner); object DeepCopy(object value); object Disassemble(object value); object Replace(object original, object target, object owner); 我不明白他们的目的是什么; 更重要的是,如何正确实施它们。 我见过的大多数例子都只返回原始输入参数。 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 […]