Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top