You just have to love open source :-)
A quick src code study brought up the solution. For anybody else facing a 
similar problem, simply extend from AuditEventListener and override 
OnPostDelete:


            public override void 
OnPostDelete(NHibernate.Event.PostDeleteEvent evt)
            {
                    //check if object has a a property State
                    var mod = evt.Entity as IHasState;
                    if (mod != null)
                    {
                        var index = 
Array.IndexOf(evt.Persister.PropertyNames, "State");
                        if (index != -1)
                        {
                            evt.DeletedState[index] = State.Deleted;
                        }
                    }

                    base.OnPostDelete(evt);
            }

Register your extended auditlistener at envers and you are done.

regards,
Peter
Am Montag, 19. September 2016 17:50:56 UTC+2 schrieb PeSo:
>
> Hello,
> anybody every needed to intercept and change a deleted entry? I know there 
> is a config entry called nhibernate.envers.store_data_at_delete.
> The problem is that we must be able to search by deleted entries in our 
> history and all queries check against our own Status column (ie not against 
> revtype).
> So in addition to storing data at delete I must also change this status 
> column to deleted.
> What would be the best extension point in Envers for this behavior? Can I 
> intercept the audit object before it gets written to the database?
>
> best regards,
> Peter
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nhusers+unsubscr...@googlegroups.com.
To post to this group, send email to nhusers@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to