question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DDRMenu - Remove Dependency on DotNetNuke.Web.Razor

See original GitHub issue

Part of: #2599

Description of problem

DotNetNuke.Modules.DDRMenu is dependent on DotNetNuke.Web.Razor which is marked for deletion in DNN 11.0 as part of the Razor Pages Pipeline Implementation.

The DDRMenu uses the RazorEngine which we can swap out to use the default Microsoft Implementation or Razor Pages.

public void Render(object source, HtmlTextWriter htmlWriter, TemplateDefinition liveDefinition)
{
    if (!(string.IsNullOrEmpty(liveDefinition.TemplateVirtualPath)))
    {
        var resolver = new PathResolver(liveDefinition.Folder);
        dynamic model = new ExpandoObject();
        model.Source = source;
        model.ControlID = DNNContext.Current.HostControl.ClientID;
        model.Options = ConvertToJson(liveDefinition.ClientOptions);
        model.DNNPath = resolver.Resolve("/", PathResolver.RelativeTo.Dnn);
        model.ManifestPath = resolver.Resolve("/", PathResolver.RelativeTo.Manifest);
        model.PortalPath = resolver.Resolve("/", PathResolver.RelativeTo.Portal);
        model.SkinPath = resolver.Resolve("/", PathResolver.RelativeTo.Skin);
        var modelDictionary = model as IDictionary<string, object>;
        liveDefinition.TemplateArguments.ForEach(a => modelDictionary.Add(a.Name, a.Value));

        var razorEngine = new RazorEngine(liveDefinition.TemplateVirtualPath, null, null);
        var writer = new StringWriter();
        razorEngine.Render<dynamic>(writer, model);

        htmlWriter.Write(writer.ToString());
    }
}

The line that is using DotNetNuke.Web.Razor is:

var razorEngine = new RazorEngine(liveDefinition.TemplateVirtualPath, null, null);

Description of solution

Ideally the new implementation of this code will use Microsoft’s System.Web.Razor. If that does not work we will use the new Razor Pages Modules

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
SkyeHoeflingcommented, Nov 7, 2019

This is still a valid work item and we are waiting for the Razor Pages PR to be submitted, which I will try and get to over the next couple months

2reactions
mitchelsellerscommented, Jul 29, 2019

I put this as 11.0 for now

Read more comments on GitHub >

github_iconTop Results From Across the Web

DDRMenu user guide
This entry should be removed if you uninstall DDRMenu. With the core menu installed, you will have the DNNMenu and SolPart upgrade templates...
Read more >
DDRMenu Razor Templates Overview
This page describes how the DDRMenu Razor template processor works. Razor-based templates provide most power, including access to the DNN ...
Read more >
DDRMenu Razor Templates Overview
In order for your theme to see and use the DDRMenu, it will need to be available as a configuration option in the...
Read more >
Razor Templates with DDR Menu in DNN 7
WebPages dependency, which holds the Razor implementation. There were some minor changes to the Razor syntax, so that what had worked before with...
Read more >
DDRMenu not rendering everything in Razor template | DNN
You're likely missing the cs file (typically "nav.cshtml") in the nav folder in the skin. It may not have been included in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found