0
Will be answered

I'm trying to debug a function in razor, is there any way to view the variable values?

Albert Gardner 6 years ago updated by daniel 6 years ago 1

Hi,

I am trying to debug a function in razor, but am having difficulties in seeing the values of variables in it. 

I am trying to see the values of the lookupfield metadata.

My function is as follows


 public static string GetLookupFieldName(IClassifier umlClass)
{
        foreach (var att in umlClass.Attributes())
        {
            if (att["Database Functions","LookupField"]=="True")
            {
                return att.Name;
            }
        }        
        return "";
    }

Can you help?

Answer

Answer
Will be answered

What you want to do is add the Output object to your function. 

You can do it like this


public static string GetLookupFieldName(IClassifier umlClass, IOutput output)

Then you can output values to "Output" window in SilverModel.

output.WriteLine(att["Database Functions","LookupField"]);

The above line will output the value of the metadata to the output window.


Hope this helps, let me know if you need more information.

Answer
Will be answered

What you want to do is add the Output object to your function. 

You can do it like this


public static string GetLookupFieldName(IClassifier umlClass, IOutput output)

Then you can output values to "Output" window in SilverModel.

output.WriteLine(att["Database Functions","LookupField"]);

The above line will output the value of the metadata to the output window.


Hope this helps, let me know if you need more information.