質問

I'm using NHibernate Envers 1.6.0 and need to use UTC timestamps instead of local for the REVTSTMP column in REVINFO.

I know the bug has been reported (NHE-122) and fixed for future version 2.0

Is there any way I can change the DefaultRevisionInfoGenerator to my own custom IRevisionInfoGenerator?

役に立ちましたか?

解決

A simple workaround is to use your own IRevisionListener. There you set the timestamp value to DateTime.UtcNow or whatever.

Assuming you're using FluentConfiguration...

var enversCfg = new FluentConfiguration();
enversCfg.SetRevisionEntity<DefaultRevisionEntity>(r => r.Id, r=> r.RevisionDate, yourRevisionListener>();

EDIT Forgot to mention... If you're using your own custom RevisionEntity (which you do above even if it is the "DefaultRevisionEntity"), you need to map this entity.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top