using System.Web; namespace Umbraco.Web { /// /// Creates and manages instances. /// public interface IUmbracoContextFactory { /// /// Ensures that a current exists. /// /// /// If an is already registered in the /// , returns a non-root reference to it. /// Otherwise, create a new instance, registers it, and return a root reference /// to it. /// If is null, the factory tries to use /// if it exists. Otherwise, it uses a dummy /// . /// /// /// using (var contextReference = contextFactory.EnsureUmbracoContext()) /// { /// var umbracoContext = contextReference.UmbracoContext; /// // use umbracoContext... /// } /// UmbracoContextReference EnsureUmbracoContext(); } }