BL0002: Component has multiple CaptureUnmatchedValues parameters
Value | |
---|---|
Rule ID | BL0002 |
Category | Usage |
Fix is breaking or non-breaking | Non-breaking |
Cause
More than one parameter on a type deriving from ComponentBase is annotated with CaptureUnmatchedValues = true
.
Rule description
For a component, exactly one parameter is expected to have the CaptureUnmatchedValues set to true
.
@code
{
[Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object> Parameter1 { get; set; }
[Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object> Parameter2 { get; set; }
}
How to fix violations
Limit a single parameter to have CaptureUnmatchedValues
set.
@code
{
[Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object> Parameter1 { get; set; }
[Parameter] public Dictionary<string, object> Parameter2 { get; set; }
}
When to suppress warnings
Do not suppress a warning from this rule.
Cộng tác với chúng tôi trên GitHub
Bạn có thể tìm thấy nguồn cho nội dung này trên GitHub, nơi bạn cũng có thể tạo và xem lại các vấn đề và yêu cầu kéo. Để biết thêm thông tin, hãy xem hướng dẫn dành cho người đóng góp của chúng tôi.
ASP.NET Core