【发布时间】:2010-05-21 06:30:50
【问题描述】:
我有一个包含 DateTime 的 Date 类?类(有助于模拟 DateTime.Now、我们的域等)。
Date 类只有一个受保护的属性:DateTime?日期
public class Date
{
protected DateTime? date;
}
// mapping in hbm
<component name="CompletedOn">
<property column="StartedOn" name="date" access="field" not-null="false" />
</component>
来自休眠文档:
Like all value types, components do not support shared references. The null value semantics of a component are ad hoc. When reloading the containing object, NHibernate will assume that if all component columns are null, then the entire component is null. This should be okay for most purposes.
我可以覆盖这种行为吗?即使日期为空,我也希望实例化我的 Date 类。
谢谢,
【问题讨论】:
标签: nhibernate nhibernate-mapping