-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
Hi,
Following this documentation: https://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-components-outside-of-aspnetcore?view=aspnetcore-9.0 I created a sample app that is able to generate emails and it works flawlessly out of the box (big kudos for that 👍).
However, the second scenario I would like to employ this mechanism to is to generate html-based reports with possibly thousands of records (perhaps even more). I set up such code based on the sample from article above and instead using .ToHtmlString()
used .WriteHtmlTo(TextWriter)
to write the report directly to the file. Unfortunately, from my testing it appears it does not matter what writer is used the memory allocation made by the renderer itself is significant. It seems that the HTML is not rendered on the fly directly to the stream, instead the whole thing is built and stored into memory and when it's ready then it's serialized into HTML string. Can you confirm this is what really happens?
If that's the case, have you considered supporting this kind of scenarios in the future? Do you have any recommendation how could I approach this problem with using the current implementation?
Describe the solution you'd like
The HTML report rendered directly to the stream as it flows without allocating the whole view in memory.
Additional context
No response