diff --git a/src/Umbraco.Core/Resolving/ManyObjectResolverBase.cs b/src/Umbraco.Core/Resolving/ManyObjectResolverBase.cs index 83e747cb03..52ac1a4ddd 100644 --- a/src/Umbraco.Core/Resolving/ManyObjectResolverBase.cs +++ b/src/Umbraco.Core/Resolving/ManyObjectResolverBase.cs @@ -90,11 +90,7 @@ namespace Umbraco.Core.Resolving protected IEnumerable Values { get - { - //we should not allow the returning/creating of objects if resolution is not yet frozen! - if (Resolution.IsFrozen) - throw new InvalidOperationException("Resolution is not frozen. It is not possible to instantiate and returng objects until resolution is frozen."); - + { switch (LifetimeScope) { case ObjectLifetimeScope.HttpRequest: @@ -137,8 +133,7 @@ namespace Umbraco.Core.Resolving /// /// The type to remove. public void Remove(Type value) - { - Resolution.EnsureNotFrozen(); + { EnsureCorrectType(value); using (new WriteLock(_lock)) { @@ -161,7 +156,6 @@ namespace Umbraco.Core.Resolving /// The object to be added. public void Add(Type value) { - Resolution.EnsureNotFrozen(); EnsureCorrectType(value); using (var l = new UpgradeableReadLock(_lock)) { @@ -189,7 +183,6 @@ namespace Umbraco.Core.Resolving /// public void Clear() { - Resolution.EnsureNotFrozen(); using (new WriteLock(_lock)) { InstanceTypes.Clear(); @@ -203,7 +196,6 @@ namespace Umbraco.Core.Resolving /// The object to insert. public void Insert(int index, Type value) { - Resolution.EnsureNotFrozen(); EnsureCorrectType(value); using (var l = new UpgradeableReadLock(_lock)) { diff --git a/src/Umbraco.Core/Resolving/Resolution.cs b/src/Umbraco.Core/Resolving/Resolution.cs deleted file mode 100644 index e53a1b46f3..0000000000 --- a/src/Umbraco.Core/Resolving/Resolution.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Umbraco.Core.Resolving -{ - // notes: nothing in Resolving is thread-safe because everything should happen when the app is starting - - internal class Resolution - { - public static event EventHandler Frozen; - - public static bool IsFrozen { get; private set; } - - public static void EnsureNotFrozen() - { - if (Resolution.IsFrozen) - throw new InvalidOperationException("Resolution is frozen. It is not possible to modify resolvers once resolution is frozen."); - } - - public static void Freeze() - { - if (Resolution.IsFrozen) - throw new InvalidOperationException("Resolution is frozen. It is not possible to freeze it again."); - - IsFrozen = true; - if (Frozen != null) - Frozen(null, null); - } - } -} diff --git a/src/Umbraco.Core/Resolving/SingleObjectResolverBase.cs b/src/Umbraco.Core/Resolving/SingleObjectResolverBase.cs index c793627c0d..08c587ed8f 100644 --- a/src/Umbraco.Core/Resolving/SingleObjectResolverBase.cs +++ b/src/Umbraco.Core/Resolving/SingleObjectResolverBase.cs @@ -49,8 +49,6 @@ namespace Umbraco.Core.Resolving set { - Resolution.EnsureNotFrozen(); - if (!_canBeNull && value == null) throw new ArgumentNullException("value"); _resolved = value; diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 67eee0d303..6a935b95fd 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -72,7 +72,6 @@ - diff --git a/src/Umbraco.Web/UmbracoApplication.cs b/src/Umbraco.Web/UmbracoApplication.cs index 402929c4c2..e1fb8d7c1f 100644 --- a/src/Umbraco.Web/UmbracoApplication.cs +++ b/src/Umbraco.Web/UmbracoApplication.cs @@ -17,8 +17,6 @@ namespace Umbraco.Web { public static event EventHandler ApplicationStarting; - public static event EventHandler ApplicationStarted; - /// /// Initializes the Umbraco application /// @@ -37,18 +35,13 @@ namespace Umbraco.Web //create the ApplicationContext ApplicationContext.Current = new ApplicationContext() { - IsReady = true // fixme + IsReady = true // fixme, do we need this? }; //find and initialize the application startup handlers ApplicationStartupHandler.RegisterHandlers(); - OnApplicationStarting(sender, e); - - //all resolvers are now frozen and cannot be modified - Umbraco.Core.Resolving.Resolution.Freeze(); - - OnApplicationStarted(sender, e); + OnApplicationStarting(sender, e); } } @@ -62,18 +55,7 @@ namespace Umbraco.Web if (ApplicationStarting != null) ApplicationStarting(sender, e); } - - /// - /// Developers can override this method to do anything they need to do once the application startup routine is completed. - /// - /// - /// - protected virtual void OnApplicationStarted(object sender, EventArgs e) - { - if (ApplicationStarted != null) - ApplicationStarted(sender, e); - } - + protected virtual void Application_Error(object sender, EventArgs e) {