gilad segal
gilad segal

Reputation: 13

Persisting DateTime when saving/updating entities in fluent nhibernate

I'm trying to persist the datetime of creation and update of entites (not relevent to versioning and concurrency) using fluent nhibernate.

To achieve this using nhibernate I would write this mapping tag:

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

How can I make fluent nhiberbate generate that mapping tag?

Upvotes: 0

Views: 828

Answers (1)

Najera
Najera

Reputation: 2879

If you mean map a DateTime property as this:

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

This is the equivalent in Fluent NHibernate:

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

Upvotes: 1

Related Questions