简体   繁体   中英

fluent nhibernate on postgresql: define default column value to current UTC date?

How does one do this?

I had assumed it was something like this:

Map(x => x.PersistedTimeStamp)
    .CustomType<UtcDateTimeType>()
    .Generated.Insert();

...this does nothing, however.

Generated.Insert() only means "the DB will generate this value on insert; retrieve it for me afterwards"

Instead, just set the property to DateTime.UtcNow in the constructor.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM