views:

40

answers:

0

Hi.

I do Update with SaveOrUpdateCopy(). Now, I have attached an event for this:

        this.EventListeners.SaveOrUpdateCopyEventListeners = new IMergeEventListener[] { new AuditableSaveOrUpdateCopyEventListener() };

In the AuditableSaveOrUpdateCopyEventListener, I have inherited from DefaultSaveOrUpdateCopyEventListener and overriden OnMerge():

public class AuditableSaveOrUpdateCopyEventListener : DefaultSaveOrUpdateCopyEventListener {
    public override void OnMerge(MergeEvent evt) {
        this.AddAuditableData(evt);
        base.OnMerge(evt);
    }

    public override void OnMerge(MergeEvent evt, System.Collections.IDictionary copyCache) {
        this.AddAuditableData(evt);
        base.OnMerge(evt, copyCache);
    }

    private void AddAuditableData(MergeEvent evt) {
        var entity = evt.Original as AuditableEntityBase;

        if (entity != null) {
            ...
        }            
    }
 }

But when I now change properties in entity, they will not be saved to the database.

Can someone give me a tip, how I can add my auditable-data for SaveOrUpdateCopy?

Thank you.

Best Regards, Thomas