I create my own common page base class:
public abstract class ViewPageBase<TModel> : WebViewPage<TModel> { public ParamBuilder<TModel> Param { get { return new ParamBuilder<TModel>(Model); } } }
Web.config:
<system.web.webPages.razor> <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <pages pageBaseType="ViewPageBase"> <namespaces> <add namespace="System.Web.Mvc" /> <add namespace="System.Web.Mvc.Ajax" /> <add namespace="System.Web.Mvc.Html" /> <add namespace="System.Web.Routing" /> </namespaces> </pages> </system.web.webPages.razor>
This entry causes the following errors:
INCORRECT_TYPE_PARAMETER_NUMBER
and
The expression tree may not contain a dynamic operation
How to register a base class of a shared page with ASP.NET MVC4 without using the @inherits in each Razor view?
source share