I saw your cross post on stackoverflow... http://stackoverflow.com/questions/13378429/storing-previous-versions-with-parent-entity-using-nhibernate-envers ... before I saw this one. I posted an answer there.
Short answer here as well; When using Envers, it take cares of auditing for you. You don't have to define your own auditing stuff in your domain model - envers will create "BookRevisions" behind the scenes for you. These will not be referenced from Book but fetched by you using Envers' query API. From: [email protected] [mailto:[email protected]] On Behalf Of Alex Brown Sent: den 14 november 2012 12:58 To: [email protected] Subject: [nhusers] Re: Retrieving the revision number and revisionType with nhibernate.enver Ok, that makes sense What I'm trying to do, is something like this: public abstract class BookBase { public virtual int ID { get; set; } public virtual string Name { get; set; } public virtual string Author { get; set; } } public class Book : BookBase { public virtual ICollection<BookRevision> PreviousVersions { get; set; } } public class BookRevision : BookBase { public virtual int VersionNumber { get; set; } public virtual DateTime VersionTimeStamp { get; set; } } So, Book has a collection of BookRevisions within it.. Is that possible? Or am I barking up the wrong tree..? On Tuesday, 13 November 2012 12:05:35 UTC, Alex Brown wrote: 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/-/P00xjIfo6vEJ. 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.
