Rename namespace from Umbraco.Core.Resolving to Umbraco.Core.ObjectResolution

This commit is contained in:
shannon@ShandemVaio
2012-08-10 13:18:13 +06:00
parent 3415554142
commit e131011667
38 changed files with 40 additions and 52 deletions

View File

@@ -0,0 +1,38 @@
using System;
namespace Umbraco.Core.ObjectResolution
{
// notes: nothing in Resolving is thread-safe because everything should happen when the app is starting
internal class Resolution
{
public static event EventHandler Frozen;
/// <summary>
/// Gets a value indicating that resolution is frozen
/// </summary>
/// <remarks>
/// The internal setter is normally used for unit tests
/// </remarks>
public static bool IsFrozen { get; internal 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);
}
}
}