[英]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" Generated.Insert()
仅表示“数据库将在插入时生成此值;之后为我检索它”
Instead, just set the property to DateTime.UtcNow
in the constructor. 相反,只需在构造函数中将属性设置为
DateTime.UtcNow
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.