Copied to clipboard

Flag this post as spam?

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


  • Mike Chambers 621 posts 1203 karma points c-trib
    Nov 20, 2012 @ 17:06
    Mike Chambers
    0

    ApplicationStartupHandler has been deprecated.... in 4.10

    could someone confirm if this is the correct way to hook up custom logic to document handlers in v4.10

     

    public class SetDefaultsHandler : IApplicationEventHandler
        {
    
            public void OnApplicationInitialized(UmbracoApplication httpApplication, ApplicationContext applicationContext)
            {
                //your code here
            }
    
            public void OnApplicationStarting(UmbracoApplication httpApplication, ApplicationContext applicationContext)
            {
                //your code here
            }
    
            public void OnApplicationStarted(UmbracoApplication httpApplication, ApplicationContext applicationContext)
            {
                //your code here
            }
    
    
            public SetDefaultsHandler()
            {
                Document.New += new Document.NewEventHandler(Document_New);
            }
    
            void Document_New(Document sender, umbraco.cms.businesslogic.NewEventArgs e)
            {
        //CODE HERE
        }
    }
    

     

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Jan 09, 2013 @ 12:06
    Stefan Kip
    0

    Nope it isn't, you shouldn't add a constructor.

    Move the "Document.New +=" line to the OnApplicationStarting method.

  • Edwin van Koppen 156 posts 270 karma points
    Jan 10, 2013 @ 10:00
    Edwin van Koppen
    0

    public void OnApplicationStarting(UmbracoApplication httpApplication, ApplicationContext applicationContext) {
                Document.AfterPublish += DocumentEvents.Document_AfterPublish;
                Document.AfterSave += DocumentEvents.Document_AfterSave;
            }

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies