Copied to clipboard

Flag this post as spam?

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


  • Kevin Jump 2342 posts 14889 karma points MVP 8x c-trib
    Feb 25, 2013 @ 19:03
    Kevin Jump
    0

    Cross compatible IApplicationEventHandler 4.11 -> 6 ?

    Hello, 

    I've been writing a few packages that sit in the background and do stuff while umbraco is running. there is a lot of posts about people overiding ApplicationBase to get things to run when Umbraco starts, but that's so 4.7.x. In 4.8/9/10 you are ment to use IApplicationEventHandler - which I am. 

    but now in Umbraco 6 i'm getting errors because IApplicationEventHandler has moved from Umbraco.Web to Umbraco.Core (i think?)

    also 

    the functions now take UmbracoApplicationBase where previously it was UmbracoApplication

    Is there something i can/should be doing to allow my dll's to work cross versions 4.11.x / 6.x+ or should i just have two copies one for 6 and one for 4.11.x ? 

    ideally if the functional calls are going to change then the Interface name should also ? if it was now IApplicationEventHandler2 then i could have a single DLL with two entry points ? but because the name is the same it throws a wobbler

     

     

     

     


  • Kevin Jump 2342 posts 14889 karma points MVP 8x c-trib
    Feb 25, 2013 @ 19:15
    Kevin Jump
    0

    i think i've answered my own question at the end there - i am now building the dll with duplicate functions so forexample 

    public void OnApplicationStarting(UmbracoApplicationBase httpApplication, ApplicationContext applicationContext)

    and 

    public void OnApplicationStarting(UmbracoApplication httpApplication, ApplicationContext applicationContext)

    then in theory in 6 the top one gets called and in 4.11 the bottom one gets called ? 
    nothing can go wrong ? right ? 
  • Kevin Jump 2342 posts 14889 karma points MVP 8x c-trib
    Feb 25, 2013 @ 19:28
    Kevin Jump
    0

    OK scratch that (and tell me to stop talking to myself) as UmbracoApplicationBase doesn't exist in 4.11.x it doesn't work. 

    so back to first question, any cross compatible way of doing this between 4.11.x and 6.x+ ?

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Feb 26, 2013 @ 10:03
    Richard Soeteman
    0

    HI Kevin,

    Use the good old ApplicationBase,I use this for all my packages and it will work for a while ;-) It will be converted to the prefered API per environment. Check my old blogpost hwo to use it http://www.richardsoeteman.net/PermaLink,guid,f470b6cf-40da-4aa9-a0d9-7b984fe9bf59.aspx

    Cheers,

    Richard

     

  • Kevin Jump 2342 posts 14889 karma points MVP 8x c-trib
    Feb 26, 2013 @ 10:26
    Kevin Jump
    0

    Yeah, ApplicationBase has been Deprecated for a while and i was trying to be a good boy : ) 

    For now I've just put some preprocessor defines in for v4 and v6 - and i'm compiling two versions of the dll. 

Please Sign in or register to post replies

Write your reply to:

Draft