Skip to content
This repository was archived by the owner on Dec 19, 2018. It is now read-only.
This repository was archived by the owner on Dec 19, 2018. It is now read-only.

Change TagHelperOutput Content, PreContent and PostContent to all be TextWriters to avoid large string allocations. #296

@NTaylorMullen

Description

@NTaylorMullen

This issue is the more concrete version of #295.

What should be done to TagHelperOutput:

  1. Change TagHelperOutput.PreContent to be TagHelperOutput.PreContentWriter.
  2. Change TagHelperOutput.Content to be TagHelperOutput.ContentWriter.
  3. Change TagHelperOutput.PostContent to be TagHelperOutput.PostContentWriter.

All new property names here should be of type https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNet.Mvc.Core/Rendering/StringCollectionTextWriter.cs but exposed as ITextWriter. This means that type will need to be transitioned into the Microsoft.AspNet.Razor.Runtime repo.

Extra additions to make this change more consumable:

  1. ITextWriter should have an extension method to write on ITextWriter into another ITextWriter.
  2. TagHelperContext's GetChildContentAsync should have an override to provide your own ITextWriter to write to.

The impact of this change will end up affecting all existing TagHelper's and will greatly affect how TagHelpers used (NOTE: Lots of impact in MVC to make this plausible).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions