Mercurial > pub > RazorEngine
view src/Web/RazorEngine.Mvc/MvcTemplateBase.cs @ 3:91d78452a4a0 default tip
sync
author | cin |
---|---|
date | Thu, 12 Feb 2015 00:20:38 +0300 |
parents | 5bca2d201ad8 |
children |
line wrap: on
line source
namespace RazorEngine.Mvc { using System; using System.Web; using System.Web.Mvc; using Templating; /// <summary> /// Provides a base implementation of an MVC-compatible template. /// </summary> public abstract class MvcTemplateBase : TemplateBase { #region Properties /// <summary> /// Gets the <see cref="HtmlHelper{Object}"/> for this template. /// </summary> public HtmlHelper<object> Html { get; private set; } /// <summary> /// Gets the <see cref="UrlHelper"/> for this template. /// </summary> public UrlHelper Url { get; private set; } #endregion #region Methods public void InitHelpers() { var httpContext = new HttpContextWrapper(HttpContext.Current); var handler = httpContext.CurrentHandler as MvcHandler; if (handler == null) throw new InvalidOperationException("Unable to run template outside of ASP.NET MVC"); } #endregion } }