BL0002 : le composant a plusieurs paramètres CaptureUnmatchedValues

Value
Identificateur de la règle BL0002
Catégorie Utilisation
Le correctif est cassant ou non cassant Sans rupture

Cause

Plusieurs paramètres sur un type dérivé de ComponentBase sont annotés avec CaptureUnmatchedValues = true.

Description de la règle

Pour un composant, un seul paramètre est censé avoir la valeur CaptureUnmatchedValues définie sur true.

@code
{
    [Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object> Parameter1 { get; set; }

    [Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object> Parameter2 { get; set; }
}

Comment corriger les violations

Définissez un paramètre unique sur CaptureUnmatchedValues.

@code
{
    [Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object> Parameter1 { get; set; }

    [Parameter] public Dictionary<string, object> Parameter2 { get; set; }
}

Quand supprimer les avertissements

Ne supprimez pas un avertissement de cette règle.