Export (0) Print
Expand All

ITextTemplatingEngineHost.ResolveParameterValue Method

Resolves the value of a parameter that is not specified in the template text, for a directive processor.

Namespace: Microsoft.VisualStudio.TextTemplating
Assembly: Microsoft.VisualStudio.TextTemplating (in microsoft.visualstudio.texttemplating.dll)

string ResolveParameterValue (
	string directiveId,
	string processorName,
	string parameterName
)
String ResolveParameterValue (
	String directiveId, 
	String processorName, 
	String parameterName
)
function ResolveParameterValue (
	directiveId : String, 
	processorName : String, 
	parameterName : String
) : String

Parameters

directiveId

The ID of the directive call that the parameter belongs to. This ID disambiguates repeated calls to the same directive from the same text template.

processorName

The name of the directive processor that the directive belongs to.

parameterName

The name of the parameter to be resolved.

Return Value

A String that represents the resolved parameter value.

If a call to a directive in a text template does not provide a value for a required parameter, the directive processor can try to get it from the host by calling this method. This method can be called 0, 1, or multiple times, for each text template transformation.

The following code example shows a possible implementation for a custom host. This code example is part of a larger example provided for the ITextTemplatingEngineHost interface.

public string ResolveParameterValue(string directiveId, string processorName, string parameterName)
{
    if (directiveId == null)
    {
        throw new ArgumentNullException("the directiveId cannot be null");
    }
    if (processorName == null)
    {
        throw new ArgumentNullException("the processorName cannot be null");
    }
    if (parameterName == null)
    {
        throw new ArgumentNullException("the parameterName cannot be null");
    }

    //code to provide "hard-coded" parameter values goes here
    //this code depends on the directive processors this host will interact with

    //if we cannot do better - return the empty string
    return String.Empty;
}

Community Additions

ADD
Show:
© 2014 Microsoft