All the examples I have seen for NHibernate.Envers
use an integer as the object id's. I would like to use Guid
's instead. Is this possible?
[Audited]
public class Person
{
public virtual Guid Id { get; set; }
public virtual String FirstName { get; set; }
public virtual String LastName { get; set; }
public virtual int Age { get; set; }
public virtual Address.Address Address { get; set; }
}
I am asking because I am seeing an exception when trying to save the REV
data:
[Sql String]: INSERT INTO REVINFO (REVTSTMP) VALUES (?); select SCOPE_IDENTITY()
{"Cannot insert the value NULL into column 'REV', table 'Auditing.dbo.REVINFO';
column does not allow nulls. INSERT fails.\r\nThe statement has been terminated."}
My revision data object has an Id of 0.
Yes, your entites can have pretty much any id type (that NHibernate Core supports). The revision entity must have a number though.
About your exception... Most probably there's something wrong with your revision entity and/or its mapping. Read the docs here, http://envers.bitbucket.org/#revisionlog.