using System; using Microsoft.AspNet.Abstractions; namespace Microsoft.AspNet.Mvc.Rendering { public class HtmlHelper : HtmlHelper, IHtmlHelper { /// /// Initializes a new instance of the class. /// public HtmlHelper(IViewEngine viewEngine) : base(viewEngine) { } /// public new ViewDataDictionary ViewData { get; private set;} public override void Contextualize([NotNull] ViewContext viewContext) { if (viewContext.ViewData == null) { throw new ArgumentException(Resources.FormatArgumentPropertyNull("ViewData"), "viewContext"); } ViewData = viewContext.ViewData as ViewDataDictionary; if (ViewData == null) { // viewContext may contain a base ViewDataDictionary instance. So complain about that type, not TModel. throw new ArgumentException(Resources.FormatArgumentPropertyUnexpectedType( "ViewData", viewContext.ViewData.GetType().FullName, typeof(ViewDataDictionary).FullName), "viewContext"); } base.Contextualize(viewContext); } } }