当 saving/updating 个实体处于流利的 nhibernate 中时保留 DateTime

Persisting DateTime when saving/updating entities in fluent nhibernate

我正在尝试使用流畅的 nhibernate 保留创建和更新实体的日期时间(与版本控制和并发无关)。

要使用 nhibernate 实现此目的,我将编写此映射标记:

<timestamp name="Timestamp" access="property" unsaved-value="null" />

如何让 fluent nhiberbate 生成那个映射标签?

如果你的意思是映射 DateTime 属性 如下:

<property name="Timestamp" type="Timestamp"/>

这相当于 Fluent NHibernate:

Map(x => x.Timestamp).CustomType<TimestampType>();