Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • andy_rose 91 posts 117 karma points
    Aug 02, 2011 @ 17:57
    andy_rose
    0

    Storing and retrieving data between subsequent events?

    This is largely related to my previous question regarding obtaining the before and after values of a property when a document is saved. The only way I can see to do this is to hook into the Document.BeforeSave event, retrieving the sender object's requried property value representing the 'before state' and persisting it somewhere. Then during the Document.AfterSave/AfterPublish event retrieving this stored value and comparing it to the sender's property value in the current method representing the 'after state'.

    My question is where is the best place to store the 'before value'? I am currently persisting it in HttpContext.Current.Session. I was wondering if I could persist as a private field of my custom ApplicationBase class that contains the two methods for the BeforeSave and AfterSave event handlers? Would this be thread/context safe in the face of multiple concurrent saves i.e. will each user have there own unique instance of this class or could it potentially be shared? Other than not using Session are there any other pros or cons?

Please Sign in or register to post replies

Write your reply to:

Draft