Resolves the value of a parameter for a directive processor if the parameter is not specified in the template text.
Namespace: Microsoft.VisualStudio.TextTemplating
Assembly: Microsoft.VisualStudio.TextTemplating (in Microsoft.VisualStudio.TextTemplating.dll)
Syntax
'宣言
Function ResolveParameterValue ( _
directiveId As String, _
processorName As String, _
parameterName As String _
) As String
'使用
Dim instance As ITextTemplatingEngineHost
Dim directiveId As String
Dim processorName As String
Dim parameterName As String
Dim returnValue As String
returnValue = instance.ResolveParameterValue(directiveId, _
processorName, parameterName)
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
Type: System.StringThe ID of the directive call to which the parameter belongs. This ID disambiguates repeated calls to the same directive from the same text template.
processorName
Type: System.StringThe name of the directive processor to which the directive belongs.
parameterName
Type: System.StringThe name of the parameter to be resolved.
Return Value
Type: System.String
A String that represents the resolved parameter value.
Remarks
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 retrieve it from the host by calling this method. This method can be called 0, 1, or multiple times for each transformation.
Examples
The following code example shows a possible implementation for a custom host. This code example is part of a larger example that is 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;
}
Public Function ResolveParameterValue(ByVal directiveId As String, ByVal processorName As String, ByVal parameterName As String) As String Implements Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost.ResolveParameterValue
If directiveId Is Nothing Then
Throw New ArgumentNullException("the directiveId cannot be null")
End If
If processorName Is Nothing Then
Throw New ArgumentNullException("the processorName cannot be null")
End If
If parameterName Is Nothing Then
Throw New ArgumentNullException("the parameterName cannot be null")
End If
'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
End Function
Permissions
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Concepts
About Text Template Hosts
Walkthrough: Creating a Custom Text Template Host
Generating Artifacts Using Text Templates
Reference
ITextTemplatingEngineHost Interface