Sha*_*bie 4 nhibernate nhibernate-mapping
我有一个包含DateTime的Date类?class(帮助模拟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>
Run Code Online (Sandbox Code Playgroud)
来自nhibernate文档:
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为null,我也希望实例化我的Date类.
谢谢,
| 归档时间: |
|
| 查看次数: |
1054 次 |
| 最近记录: |