Implements the parameter alias pattern for Blazor components where multiple parameter names map to the same behavior. Covers independent auto-property declaration, invocation-site coalescing, and HasDelegate guard updates. Use when a Blazor component needs backward-compatible parameter names, supporting On-prefixed event aliases, or ensuring Web Forms markup migration works without breaking existing consumers.
95
92%
Does it follow best practices?
Impact
100%
1.36xAverage score across 3 eval scenarios
Passed
No known issues
When a Blazor component needs to support multiple parameter names for the same behavior — typically for Web Forms migration compatibility where event names use an On prefix in markup (OnSorting) but the component originally defined the property without it (Sorting).
[Parameter] property// Existing property (keep as-is)
[Parameter] public EventCallback<GridViewSortEventArgs> Sorting { get; set; }
/// <summary>
/// Web Forms migration alias for Sorting.
/// </summary>
[Parameter] public EventCallback<GridViewSortEventArgs> OnSorting { get; set; }Critical: Both properties must be independent auto-properties. Do NOT use a getter/setter that delegates to the other property — Blazor's parameter diffing sets properties by name and won't detect changes through delegation.
Wherever the component invokes the event internally, prefer the original if it has a delegate, falling back to the alias:
var sortingHandler = Sorting.HasDelegate ? Sorting : OnSorting;
await sortingHandler.InvokeAsync(args);If the component uses .HasDelegate to conditionally show UI (e.g., command columns), check both:
internal bool ShowCommandColumn => RowEditing.HasDelegate || OnRowEditing.HasDelegate;[Parameter] is set independently.<GridView OnSorting="Handler">, Blazor sets the OnSorting property. The Sorting property remains default (no delegate).Sorting still works; migrated code using OnSorting also works.❌ Don't delegate via getter/setter:
// WRONG — Blazor won't detect changes
[Parameter] public EventCallback<T> OnSorting
{
get => Sorting;
set => Sorting = value;
}❌ Don't rename the original property — that would break existing consumers.
❌ Don't invoke both callbacks — the consumer only sets one, so only one should fire.
1bd9b17
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.