Copied to clipboard

Flag this post as spam?

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


  • Paul 25 posts 75 karma points
    Sep 21, 2015 @ 13:39
    Paul
    0

    Property was dirty on saved

    A question about the property service, on the saved event.

    if i use the onsaving event:

    void ContentService_Saving(IContentService sender, SaveEventArgs<IContent> e)
    {
        foreach (IContent node in e.SavedEntities)
        {
        if(node.IsPropertyDirty("property name"))
        {
            //Do something
        }
    }       
    
    }
    

    When i edit the property it is true and the code would work as i expect.

    However if i do the same thing on the saved event and use was property dirty, it will always return true even if i have not edited the property in the CMS.

    void ContentService_Saved(IContentService sender, SaveEventArgs<IContent> e)
    {
        foreach (IContent node in e.SavedEntities)
        {
            if(node.WasPropertyDirty("property name"))
            {
                //Do something
            }
        }       
    
    }
    

    Am i missing something here why would a property be marked dirty if it hasn't been changed?

Please Sign in or register to post replies

Write your reply to:

Draft