Partilhar via


BL0002: O componente possui múltiplos parâmetros CaptureUnmatchedValues

Valor
ID da regra BL0002
Categoria Utilização
A correção é invasiva ou não invasiva Inquebrável

Motivo

Mais de um parâmetro em um tipo derivado de ComponentBase é anotado com CaptureUnmatchedValues = true.

Descrição da regra

Espera-se que, para um componente, exatamente um parâmetro tenha o CaptureUnmatchedValues definido como true.

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

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

Como corrigir violações

Limite um único parâmetro a ser CaptureUnmatchedValues definido.

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

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

Quando suprimir avisos

Não ignore um aviso desta regra.