diff --git a/src/Umbraco.Web/ApplicationEventsResolver.cs b/src/Umbraco.Web/ApplicationEventsResolver.cs
index 93edaae441..1478ef6cbf 100644
--- a/src/Umbraco.Web/ApplicationEventsResolver.cs
+++ b/src/Umbraco.Web/ApplicationEventsResolver.cs
@@ -1,49 +1,86 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Umbraco.Core;
using Umbraco.Core.ObjectResolution;
using umbraco.interfaces;
namespace Umbraco.Web
{
- ///
- /// A resolver to return all IApplicationEvents objects
- ///
- internal sealed class ApplicationEventsResolver : ManyObjectsResolverBase
- {
+ ///
+ /// A resolver to return all IApplicationEvents objects
+ ///
+ internal sealed class ApplicationEventsResolver : ManyObjectsResolverBase
+ {
- ///
- /// Constructor
- ///
- ///
- internal ApplicationEventsResolver(IEnumerable applicationEventHandlers)
- : base(applicationEventHandlers)
- {
+ private readonly LegacyStartupHandlerResolver _legacyResolver;
- }
+ ///
+ /// Constructor
+ ///
+ ///
+ internal ApplicationEventsResolver(IEnumerable applicationEventHandlers)
+ : base(applicationEventHandlers)
+ {
+ //create the legacy resolver and only include the legacy types
+ _legacyResolver = new LegacyStartupHandlerResolver(
+ applicationEventHandlers.Where(x => !TypeHelper.IsTypeAssignableFrom(x)));
+ }
- ///
- /// Gets the implementations.
- ///
- public IEnumerable ApplicationEventHandlers
- {
- get { return Values.OfType(); }
- }
+ ///
+ /// Override in order to only return types of IApplicationEventHandler and above,
+ /// do not include the legacy types of IApplicationStartupHandler
+ ///
+ protected override IEnumerable InstanceTypes
+ {
+ get { return base.InstanceTypes.Where(TypeHelper.IsTypeAssignableFrom); }
+ }
- protected override bool SupportsClear
- {
- get { return false; }
- }
+ ///
+ /// Gets the implementations.
+ ///
+ public IEnumerable ApplicationEventHandlers
+ {
+ get { return Values; }
+ }
- protected override bool SupportsInsert
- {
- get { return false; }
- }
+ ///
+ /// Create instances of all of the legacy startup handlers
+ ///
+ public void InstantiateLegacyStartupHanlders()
+ {
+ //this will instantiate them all
+ var handlers = _legacyResolver.LegacyStartupHandlers;
+ }
- protected override bool SupportsRemove
- {
- get { return false; }
- }
+ protected override bool SupportsClear
+ {
+ get { return false; }
+ }
- }
+ protected override bool SupportsInsert
+ {
+ get { return false; }
+ }
+
+ protected override bool SupportsRemove
+ {
+ get { return false; }
+ }
+
+ private class LegacyStartupHandlerResolver : ManyObjectsResolverBase
+ {
+ internal LegacyStartupHandlerResolver(IEnumerable legacyStartupHandlers)
+ : base(legacyStartupHandlers)
+ {
+
+ }
+
+ public IEnumerable LegacyStartupHandlers
+ {
+ get { return Values; }
+ }
+ }
+
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Web/WebBootManager.cs b/src/Umbraco.Web/WebBootManager.cs
index a6ead39ab5..6edccc967f 100644
--- a/src/Umbraco.Web/WebBootManager.cs
+++ b/src/Umbraco.Web/WebBootManager.cs
@@ -130,6 +130,9 @@ namespace Umbraco.Web
ApplicationEventsResolver.Current.ApplicationEventHandlers
.ForEach(x => x.OnApplicationStarted(_umbracoApplication, ApplicationContext));
+ //Now, startup all of our legacy startup handler
+ ApplicationEventsResolver.Current.InstantiateLegacyStartupHanlders();
+
// we're ready to serve content!
ApplicationContext.IsReady = true;