Context
Use this when changing the Web Forms to Blazor CLI markup pipeline anywhere near GridView column transforms, template context handling, data-binding expression rewrites, or asp-prefix stripping. TemplateField preservation is a cross-transform behavior, so regressions can appear even when each individual transform still looks correct in isolation.
Patterns
- Treat
TemplateFieldpreservation as an ordered pipeline contract:DisplayExpressionTransformAspPrefixTransformDataBindingAttributeTransformAttributeStripTransformGridViewColumnItemTypeTransformTemplateContextTransform
- Keep regression coverage at two levels:
- Transform-only markup assertions through
TestHelpers.CreateDefaultPipeline(). - Full-file migration assertions through
MigrationPipeline.ExecuteAsync().
- Transform-only markup assertions through
- Cover these GridView shapes explicitly:
- TemplateField with inner
TextBox - TemplateField with inner
CheckBox - TemplateField with inline display expression only
- Mixed
BoundField+TemplateFieldsiblings - GridView with only TemplateField columns
- TemplateField with inner
- Assert both preservation and non-regression:
- Expected
<TemplateField ...>count remains stable - Inner controls survive as BWFC components (
<TextBox>,<CheckBox>) ItemTemplate Context="Item"is present- No unexpected fallback
<BoundField>appears for template-only columns
- Expected
Examples
tests/BlazorWebFormsComponents.Cli.Tests/TransformUnit/GridViewColumnItemTypeTransformTests.cstests/BlazorWebFormsComponents.Cli.Tests/PipelineIntegrationTests.cs
Anti-Patterns
- Testing only
GridViewColumnItemTypeTransformin isolation after changing template-related transforms. - Verifying only the first GridView column and assuming later TemplateField siblings survived.
- Accepting output that preserves the
TemplateFieldshell but drops nested controls or display expressions. - Changing transform order in
Program.cswithout mirroring the same coverage throughtests/BlazorWebFormsComponents.Cli.Tests/TestHelpers.cs.