Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Tom 711 posts 948 karma points
    Mar 05, 2015 @ 00:06

    Custom Razor Page Base Type

    Hi Just wondering if it was possible to inherit from umbraco.MacroEngines.DynamicNodeContext to have a custom pageBaseType for razor views?

    I've tried:

    public abstract class MyViewPage : umbraco.MacroEngines.DynamicNodeContext
            public MyHelper My { get; set; }
    public override void InitHelpers() { base.InitHelpers(); My= new MyHelper<object>(base.ViewContext, this);
    } }
        <host factoryType="umbraco.MacroEngines.RazorUmbracoFactory, umbraco.MacroEngines" />
        <pages pageBaseType="umbraco.MacroEngines.DynamicNodeContext">
            <add namespace="Microsoft.Web.Helpers" />
            <add namespace="umbraco" />
            <add namespace="Examine" />

    The base class doesn't contain a viewcontext to hook in to. I was wondering what was required to hook this up?

  • Asbjørn 75 posts 180 karma points c-trib
    Mar 05, 2015 @ 17:35

    Which Umbraco version are you using? umbraco.MacroEngines.DynamicNodeContext is only used for the old Razor Macros, which are deprecated as of v6.

    If you're using full MVC views (in the Views folder), you'd probably want to inherit from UmbracoViewPage or UmbracoTemplatePage.

    What are you trying to achieve?


Please Sign in or register to post replies

Write your reply to: