Files
Umbraco-CMS/src/Umbraco.Web/Composing/ModuleInjector.cs

30 lines
786 B
C#
Raw Normal View History

using System.Web;
2018-07-20 09:49:05 +02:00
using Umbraco.Core;
namespace Umbraco.Web.Composing
{
/// <summary>
/// Provides a base class for module injectors.
/// </summary>
/// <typeparam name="TModule">The type of the injected module.</typeparam>
public abstract class ModuleInjector<TModule> : IHttpModule
where TModule : IHttpModule
{
protected TModule Module { get; private set; }
/// <inheritdoc />
public void Init(HttpApplication context)
{
// using the service locator here - no other way, really
Module = Current.Container.GetInstance<TModule>();
Module.Init(context);
}
/// <inheritdoc />
public void Dispose()
{
Module?.Dispose();
}
}
}