/// <summary> /// Instantiates a new <see cref="CSharpTagHelperCodeRenderer"/>. /// </summary> /// <param name="bodyVisitor">The <see cref="IChunkVisitor"/> used to render chunks found in the body.</param> /// <param name="writer">The <see cref="CSharpCodeWriter"/> used to write code.</param> /// <param name="context">A <see cref="CodeGeneratorContext"/> instance that contains information about /// the current code generation process.</param> public CSharpTagHelperCodeRenderer( IChunkVisitor bodyVisitor, CSharpCodeWriter writer, CodeGeneratorContext context) { if (bodyVisitor == null) { throw new ArgumentNullException(nameof(bodyVisitor)); } if (writer == null) { throw new ArgumentNullException(nameof(writer)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } _bodyVisitor = bodyVisitor; _writer = writer; _context = context; _tagHelperContext = context.Host.GeneratedClassContext.GeneratedTagHelperContext; _designTimeMode = context.Host.DesignTimeMode; _literalBodyVisitor = new CSharpLiteralCodeVisitor(this, writer, context); _attributeCodeVisitor = new TagHelperAttributeCodeVisitor(writer, context); AttributeValueCodeRenderer = new TagHelperAttributeValueCodeRenderer(); }
/// <summary> /// Instantiates a new <see cref="CSharpTagHelperCodeRenderer"/>. /// </summary> /// <param name="bodyVisitor">The <see cref="IChunkVisitor"/> used to render chunks found in the body.</param> /// <param name="writer">The <see cref="CSharpCodeWriter"/> used to write code.</param> /// <param name="context">A <see cref="CodeGeneratorContext"/> instance that contains information about /// the current code generation process.</param> public CSharpTagHelperCodeRenderer( IChunkVisitor bodyVisitor, CSharpCodeWriter writer, CodeGeneratorContext context) { if (bodyVisitor == null) { throw new ArgumentNullException(nameof(bodyVisitor)); } if (writer == null) { throw new ArgumentNullException(nameof(writer)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } _bodyVisitor = bodyVisitor; _writer = writer; _context = context; _tagHelperContext = context.Host.GeneratedClassContext.GeneratedTagHelperContext; _designTimeMode = context.Host.DesignTimeMode; _literalBodyVisitor = new CSharpLiteralCodeVisitor(this, writer, context); _attributeCodeVisitor = new TagHelperAttributeCodeVisitor(writer, context); AttributeValueCodeRenderer = new TagHelperAttributeValueCodeRenderer(); }
public GeneratedClassContext( string executeMethodName, string writeMethodName, string writeLiteralMethodName, GeneratedTagHelperContext generatedTagHelperContext) : this() { if (generatedTagHelperContext == null) { throw new ArgumentNullException(nameof(generatedTagHelperContext)); } if (string.IsNullOrEmpty(executeMethodName)) { throw new ArgumentException( CommonResources.Argument_Cannot_Be_Null_Or_Empty, nameof(executeMethodName)); } if (string.IsNullOrEmpty(writeMethodName)) { throw new ArgumentException( CommonResources.Argument_Cannot_Be_Null_Or_Empty, nameof(writeMethodName)); } if (string.IsNullOrEmpty(writeLiteralMethodName)) { throw new ArgumentException( CommonResources.Argument_Cannot_Be_Null_Or_Empty, nameof(writeLiteralMethodName)); } GeneratedTagHelperContext = generatedTagHelperContext; WriteMethodName = writeMethodName; WriteLiteralMethodName = writeLiteralMethodName; ExecuteMethodName = executeMethodName; WriteToMethodName = null; WriteLiteralToMethodName = null; TemplateTypeName = null; DefineSectionMethodName = null; BeginWriteAttributeMethodName = DefaultBeginWriteAttributeMethodName; BeginWriteAttributeToMethodName = DefaultBeginWriteAttributeToMethodName; EndWriteAttributeMethodName = DefaultEndWriteAttributeMethodName; EndWriteAttributeToMethodName = DefaultEndWriteAttributeToMethodName; WriteAttributeValueMethodName = DefaultWriteAttributeValueMethodName; WriteAttributeValueToMethodName = DefaultWriteAttributeValueToMethodName; }
public GeneratedClassContext( string executeMethodName, string writeMethodName, string writeLiteralMethodName, GeneratedTagHelperContext generatedTagHelperContext) : this() { if (generatedTagHelperContext == null) { throw new ArgumentNullException(nameof(generatedTagHelperContext)); } if (string.IsNullOrEmpty(executeMethodName)) { throw new ArgumentException( CommonResources.Argument_Cannot_Be_Null_Or_Empty, nameof(executeMethodName)); } if (string.IsNullOrEmpty(writeMethodName)) { throw new ArgumentException( CommonResources.Argument_Cannot_Be_Null_Or_Empty, nameof(writeMethodName)); } if (string.IsNullOrEmpty(writeLiteralMethodName)) { throw new ArgumentException( CommonResources.Argument_Cannot_Be_Null_Or_Empty, nameof(writeLiteralMethodName)); } GeneratedTagHelperContext = generatedTagHelperContext; WriteMethodName = writeMethodName; WriteLiteralMethodName = writeLiteralMethodName; ExecuteMethodName = executeMethodName; WriteToMethodName = null; WriteLiteralToMethodName = null; TemplateTypeName = null; DefineSectionMethodName = null; BeginWriteAttributeMethodName = DefaultBeginWriteAttributeMethodName; BeginWriteAttributeToMethodName = DefaultBeginWriteAttributeToMethodName; EndWriteAttributeMethodName = DefaultEndWriteAttributeMethodName; EndWriteAttributeToMethodName = DefaultEndWriteAttributeToMethodName; WriteAttributeValueMethodName = DefaultWriteAttributeValueMethodName; WriteAttributeValueToMethodName = DefaultWriteAttributeValueToMethodName; }
public GeneratedClassContext( string executeMethodName, string writeMethodName, string writeLiteralMethodName, string writeToMethodName, string writeLiteralToMethodName, string templateTypeName, GeneratedTagHelperContext generatedTagHelperContext) : this(executeMethodName, writeMethodName, writeLiteralMethodName, generatedTagHelperContext) { WriteToMethodName = writeToMethodName; WriteLiteralToMethodName = writeLiteralToMethodName; TemplateTypeName = templateTypeName; }
public GeneratedClassContext( string executeMethodName, string writeMethodName, string writeLiteralMethodName, string writeToMethodName, string writeLiteralToMethodName, string templateTypeName, string defineSectionMethodName, GeneratedTagHelperContext generatedTagHelperContext) : this(executeMethodName, writeMethodName, writeLiteralMethodName, writeToMethodName, writeLiteralToMethodName, templateTypeName, generatedTagHelperContext) { DefineSectionMethodName = defineSectionMethodName; }
public GeneratedClassContext( string executeMethodName, string writeMethodName, string writeLiteralMethodName, string writeToMethodName, string writeLiteralToMethodName, string templateTypeName, GeneratedTagHelperContext generatedTagHelperContext) : this(executeMethodName, writeMethodName, writeLiteralMethodName, generatedTagHelperContext) { WriteToMethodName = writeToMethodName; WriteLiteralToMethodName = writeLiteralToMethodName; TemplateTypeName = templateTypeName; }
public GeneratedClassContext( string executeMethodName, string writeMethodName, string writeLiteralMethodName, string writeToMethodName, string writeLiteralToMethodName, string templateTypeName, string defineSectionMethodName, string beginContextMethodName, string endContextMethodName, GeneratedTagHelperContext generatedTagHelperContext) : this(executeMethodName, writeMethodName, writeLiteralMethodName, writeToMethodName, writeLiteralToMethodName, templateTypeName, defineSectionMethodName, generatedTagHelperContext) { BeginContextMethodName = beginContextMethodName; EndContextMethodName = endContextMethodName; }