Core.ObjectsResolution - cleanup + start making things public

This commit is contained in:
Stephan
2013-01-16 13:10:34 -01:00
parent e7b84b1637
commit bfd8e96f71
7 changed files with 352 additions and 131 deletions

View File

@@ -2,29 +2,43 @@
namespace Umbraco.Core.ObjectResolution
{
// notes: nothing in Resolving is thread-safe because everything should happen when the app is starting
/// <summary>
/// Represents the status of objects resolution.
/// </summary>
/// <remarks>
/// <para>Objects resolution can be frozen ie nothing can change anymore.</para>
/// <para>Nothing in resolution is thread-safe, because everything should take place when the application is starting.</para>
/// </remarks>
internal class Resolution
{
// NOTE : must clarify freezing... SingleObjectResolverBase does not honor it...
/// <summary>
/// Occurs when resolution is frozen.
/// </summary>
/// <remarks>Occurs only once, since resolution can be frozen only once.</remarks>
public static event EventHandler Frozen;
/// <summary>
/// Gets a value indicating that resolution is frozen
/// Gets or sets a value indicating whether resolution of objects is frozen.
/// </summary>
/// <remarks>
/// The internal setter is normally used for unit tests
/// </remarks>
/// <remarks>The internal setter is to be used in unit tests.</remarks>
public static bool IsFrozen { get; internal set; }
/// <summary>
/// Ensures that resolution is not frozen, else throws.
/// </summary>
/// <exception cref="InvalidOperationException">resolution is frozen.</exception>
public static void EnsureNotFrozen()
{
if (Resolution.IsFrozen)
throw new InvalidOperationException("Resolution is frozen. It is not possible to modify resolvers once resolution is frozen.");
}
/// <summary>
/// Freezes resolution.
/// </summary>
/// <exception cref="InvalidOperationException">resolution is already frozen.</exception>
public static void Freeze()
{
if (Resolution.IsFrozen)