RequiresProvidesDirectiveProcessor.GenerateTransformCode Method
When overridden in a derived class, adds code to the generated transformation class.
Namespace: Microsoft.VisualStudio.TextTemplating
Assembly: Microsoft.VisualStudio.TextTemplating.11.0 (in Microsoft.VisualStudio.TextTemplating.11.0.dll)
Syntax
'Declaration
Protected MustOverride Sub GenerateTransformCode ( _
directiveName As String, _
codeBuffer As StringBuilder, _
languageProvider As CodeDomProvider, _
requiresArguments As IDictionary(Of String, String), _
providesArguments As IDictionary(Of String, String) _
)
protected abstract void GenerateTransformCode(
string directiveName,
StringBuilder codeBuffer,
CodeDomProvider languageProvider,
IDictionary<string, string> requiresArguments,
IDictionary<string, string> providesArguments
)
protected:
virtual void GenerateTransformCode(
String^ directiveName,
StringBuilder^ codeBuffer,
CodeDomProvider^ languageProvider,
IDictionary<String^, String^>^ requiresArguments,
IDictionary<String^, String^>^ providesArguments
) abstract
abstract GenerateTransformCode :
directiveName:string *
codeBuffer:StringBuilder *
languageProvider:CodeDomProvider *
requiresArguments:IDictionary<string, string> *
providesArguments:IDictionary<string, string> -> unit
protected abstract function GenerateTransformCode(
directiveName : String,
codeBuffer : StringBuilder,
languageProvider : CodeDomProvider,
requiresArguments : IDictionary<String, String>,
providesArguments : IDictionary<String, String>
)
Parameters
directiveName
Type: StringThe name of the directive.
codeBuffer
Type: StringBuilderThe buffer that concatenates the code that this directive processor adds to the generated transformation class during a processing run.
languageProvider
Type: CodeDomProviderThe code generator that creates the code to add to codeBuffer.
requiresArguments
Type: IDictionary<String, String>The standard parameters that the directive processor requires.
providesArguments
Type: IDictionary<String, String>The standard parameters that the directive processor provides.
Remarks
This is called by ProcessDirective.
Examples
This example generates code for the directive processor. This code example is part of a larger example that is provided for the RequiresProvidesDirectiveProcessor class.
protected override void GenerateTransformCode(string directiveName, StringBuilder codeBuffer, System.CodeDom.Compiler.CodeDomProvider languageProvider, IDictionary<string, string> requiresArguments, IDictionary<string, string> providesArguments)
{
// Write code to create a property backed by a field of type XmlDocument.
// The property is named "Dom" by default but the template writer may have changed the name using a custom provides clause like 'provides="Dom=AnotherName"'
string fieldName = providesArguments[DomProvidedParameterName].ToLower(CultureInfo.InvariantCulture) + "Value";
string propertyName = providesArguments[DomProvidedParameterName];
codeBuffer.Append(
"XmlDocument " + fieldName + ";" +
"XmlDocument " + propertyName +
"{ get { return this." + fieldName + "; } }");
}
.NET Framework Security
- 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
Reference
RequiresProvidesDirectiveProcessor Class
Microsoft.VisualStudio.TextTemplating Namespace