What is "License"? I guess that's an entity? Your revision entity must not derive from any "normal" entity.
If you specify a custom revision entity (you don't have to), this type is global for all entities. This type must contain a revision number and a timestamp/date but often also includes eg who did the change. http://envers.bitbucket.org/#revisionlog From: [email protected] [mailto:[email protected]] On Behalf Of Alex Brown Sent: den 13 november 2012 16:40 To: [email protected] Subject: Re: [nhusers] Retrieving the revision number and revisionType with nhibernate.enver I'm trying that... however, I'm getting Operand type clash: uniqueidentifier is incompatible with int Which (i think) is understandable.... It's querying on ID (which is a Guid) to get the revision number. Here's my revision type: public class MyClassRevision : License { public virtual int REV { get; set; } public virtual int REVTYPE { get; set; } public virtual DateTime REVTIMESTAMP { get; set; } } I've then got this in my config enversConf.SetRevisionEntity<MyClassRevision>(x => x.REV, x => x.REVTIMESTAMP); I map MyClassRevision like this: (I'm using fluent nHibernate) public class MyClassRevisionMap : SubclassMap<MyClassRevision> { public MyClassRevisionMap () { Map(x => x.REV); Map(x => x.REVTIMESTAMP); Map(x => x.REVTYPE); } } And finally, the line that's throwing the error is: var auditReaderResults = _session.Auditer() .CreateQuery() .ForHistoryOf<MyClass, MyClassRevision>() .Add(AuditEntity.Id().Eq(new Guid("EB7027C0-687A-446F-AFF7-E6CF7BEE3391"))) .Results(); Somewhere I think the mapping from ID to VersionNumber has gone wrong...? On Tuesday, 13 November 2012 14:23:49 UTC, Roger wrote: Use ForHistoryOf<entityType, revEntityType>() Instead of ForRevisionsOf From: [email protected]<javascript:> [mailto:[email protected]<javascript:>] On Behalf Of Alex Brown Sent: den 13 november 2012 13:06 To: [email protected]<javascript:> Subject: [nhusers] Retrieving the revision number and revisionType with nhibernate.enver I'm querying my revisions like this: var auditReaderResults = _session.Auditer() .CreateQuery() .ForRevisionsOf<MyClass>() .Add(AuditEntity.Id().Eq(new Guid("EB7027C0-687A-446F-AFF7-E6CF7BEE3391"))) .Results(); This is bringing back the correct entities, but I was wondering if there was a way to also bring back the REV and REVTYPE data? Would I create a MyClassRevision entity (inheriting from MyClass) for example, with the REV and REVTYPE properties on? -- You received this message because you are subscribed to the Google Groups "nhusers" group. To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/s3AqMunsC4EJ. To post to this group, send email to [email protected]<javascript:>. To unsubscribe from this group, send email to [email protected]<javascript:>. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/R2bgrMkHfC8J. To post to this group, send email to [email protected]<mailto:[email protected]>. To unsubscribe from this group, send email to [email protected]<mailto:[email protected]>. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
