Bypass model validation for rendering models #12999
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prerequisites
If there's an existing issue for this PR then this fixes #12579
Description
The slow rendering described in the linked issue is tied to how ASP.NET Core performs validation; specifically validation of object graphs. The more content items exist in near vicinity (parent, children, siblings) of the item being rendered, the larger object graph is traversed.
The only reasonable fix is to disable validation of rendering models, namely models built upon
ContentModel
orIPublishedContent
(ModelsBuilder models).As this is a behavioral breaking change, we cannot target V10, so the target of this PR is V11.
Testing this fix
The files needed for testing is attached in this ZIP file.
SourceCodeAuto
orSourceCodeManual
to generate the Article model (required by the next step)ArticleController
in the projectIt is probably a good idea to enable the mini profiler by default when measuring the rendering times: