Copied to clipboard

Flag this post as spam?

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


  • Ed Johnson 8 posts 58 karma points
    Oct 11, 2013 @ 22:04
    Ed Johnson
    0

    Macro Engine Problem

    Hello friends, first time poster here. I am running into an issue that I hope can be resolved through this form because I have been at it for several days to no avail. 

    I recently started working for a company that does some of its clients CMSs using Umbraco. The problem is that I am a .NET developer that was given the task of maintaing the code that a previous developer left when she worked on the Umbraco CMS. So I can't just ask her what she was doing, otherwise I wouldn't be here.

    Enough blaberring, here is my problem:

    She was getting some data from a stored procedure in a SQL Server database, simple enough. However, after that she was using that data and loading it into a macro's properties, then she executed the macro. Again, I am not too familiar with Umbraco, I have tried to replicate this behavior but I can't find, or don't understand, what she is doing. Here is the code that she was using to load and execute the macros:

    private static string loadRazorMacro(int pageId, string name, List<MacroPropertyModel> properties){

    try

        {

                  INode currentPage = new Node(pageId);

                  RazorMacroEngine engine = new RazorMacroEngine();

                  MacroModel macro = new MacroModel

                   {

                      ScriptCode = "",

                      ScriptLanguage = "cshtml",

                      ScriptName = name + ".cshtml",

                      Properties = properties

                  };

                  return engine.Execute(macro, currentPage);

              }

               catch (Exception exception)

               {

                return (exception.Message + exception.StackTrace.ToString());

               }

    }

    The class that I can't find is the RazorMacroEngine, is this an umbraco class? Or is it something custom she made? 

    This all happens in a .NET class library, this is why the people at my company placed me on this project. We access the class library's methods through jquery ajax in our templates. 

    Please forgive me if this is something trivial, again I am fairly new to umbraco. 

    Please feel free to ask for more information if it is needed. 

    Thank you in advance.

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Oct 11, 2013 @ 22:47
    Jeavon Leopold
    0

    Hi Ed,

    Welcome to Our!

    Yes, RazorMacroEngine is an Umbraco class and it can be found in the umbraco.MacroEngines namespace.

    Hope that helps you?

    Jeavon

Please Sign in or register to post replies

Write your reply to:

Draft