Copied to clipboard

Flag this post as spam?

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


  • Amna Butt 20 posts 140 karma points
    Jan 28, 2018 @ 19:01
    Amna Butt
    0

    Unregister the registered event

    While creating a package, I have registered an event in ApplicationStarted like this:

    Umbraco.Core.Services.ContentService.Published +=ContentService_Published;
    

    The ApplicationStarted method is part of my package custom class. Now on uninstalling the package, I wanted to unregister this event. How to do it? Adding "minus" sign is not working

    Umbraco.Core.Services.ContentService.Published -=ContentService_Published;
    
  • Nigel Wilson 945 posts 2077 karma points
    Jan 28, 2018 @ 21:51
    Nigel Wilson
    100

    Hi Amna

    If the Application started method is part of a package, then I assume it is part of a dll file that gets copied on install of the package.

    If so, then when you uninstall the package, the custom dll would be removed from the site, therefore removing the Application Started event ?

    Or have I misunderstood your question ?

    Nigel

  • Amna Butt 20 posts 140 karma points
    Jan 29, 2018 @ 06:49
    Amna Butt
    0

    Yes Nigel, You are right. I was confused if the events which get bind once will always be there.

  • Nigel Wilson 945 posts 2077 karma points
    Jan 29, 2018 @ 07:19
    Nigel Wilson
    0

    All good - please mark a reply as a solution so others know it's sorted.

    Cheers

Please Sign in or register to post replies

Write your reply to:

Draft