2

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?

Roger
  • 1,944
  • 1
  • 11
  • 17
Mike737
  • 836
  • 5
  • 16

1 Answers1

5

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.

Roger
  • 1,944
  • 1
  • 11
  • 17