diff --git a/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs b/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs index 02ba2fa03e..ff2219e59e 100644 --- a/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs +++ b/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs @@ -767,7 +767,7 @@ namespace Microsoft.AspNetCore.Components.RenderTree public void AddContent(int sequence, Microsoft.AspNetCore.Components.RenderFragment fragment, T value) { } public void AddElementReferenceCapture(int sequence, System.Action elementReferenceCaptureAction) { } public void AddMarkupContent(int sequence, string markupContent) { } - public void AddMultipleAttributes(int sequence, System.Collections.Generic.IEnumerable> attributes) { } + public void AddMultipleAttributes(int sequence, System.Collections.Generic.IEnumerable> attributes) { } public void Clear() { } public void CloseComponent() { } public void CloseElement() { } diff --git a/src/Components/Components/src/ParameterAttribute.cs b/src/Components/Components/src/ParameterAttribute.cs index 5fb5ec2088..afad81d525 100644 --- a/src/Components/Components/src/ParameterAttribute.cs +++ b/src/Components/Components/src/ParameterAttribute.cs @@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// should only be applied to parameters of a type that - /// can be used with + /// can be used with /// such as . /// /// diff --git a/src/Components/Components/src/RenderTree/RenderTreeBuilder.cs b/src/Components/Components/src/RenderTree/RenderTreeBuilder.cs index c6ae2998f2..46d2295e3d 100644 --- a/src/Components/Components/src/RenderTree/RenderTreeBuilder.cs +++ b/src/Components/Components/src/RenderTree/RenderTreeBuilder.cs @@ -485,19 +485,10 @@ namespace Microsoft.AspNetCore.Components.RenderTree /// /// Adds frames representing multiple attributes with the same sequence number. /// - /// The attribute value type. /// An integer that represents the position of the instruction in the source code. /// A collection of key-value pairs representing attributes. - public void AddMultipleAttributes(int sequence, IEnumerable> attributes) + public void AddMultipleAttributes(int sequence, IEnumerable> attributes) { - // NOTE: The IEnumerable> is the simplest way to support a variety of - // different types like IReadOnlyDictionary<>, Dictionary<>, and IDictionary<>. - // - // None of those types are contravariant, and since we want to support attributes having a value - // of type object, the simplest thing to do is drop down to IEnumerable> which - // is contravariant. This also gives us things like List> and KeyValuePair<>[] - // for free even though we don't expect those types to be common. - // Calling this up-front just to make sure we validate before mutating anything. AssertCanAddAttribute(); diff --git a/src/Components/Components/test/RenderTreeBuilderTest.cs b/src/Components/Components/test/RenderTreeBuilderTest.cs index c92ee63658..bfd73e040d 100644 --- a/src/Components/Components/test/RenderTreeBuilderTest.cs +++ b/src/Components/Components/test/RenderTreeBuilderTest.cs @@ -254,7 +254,7 @@ namespace Microsoft.AspNetCore.Components.Test // Act builder.OpenElement(0, "myelement"); - builder.AddMultipleAttributes(0, null); + builder.AddMultipleAttributes(0, null); builder.CloseElement(); // Assert @@ -307,20 +307,6 @@ namespace Microsoft.AspNetCore.Components.Test frame => AssertFrame.Attribute(frame, "attribute7", "the end")); } - [Fact] - public void CanAddMultipleAttributes_DictionaryString() - { - var attributes = new Dictionary - { - { "attribute1", "test1" }, - { "attribute2", "123" }, - { "attribute3", "456" }, - }; - - // Act & Assert - CanAddMultipleAttributesTest(attributes); - } - [Fact] public void CanAddMultipleAttributes_DictionaryObject() { @@ -335,20 +321,6 @@ namespace Microsoft.AspNetCore.Components.Test CanAddMultipleAttributesTest(attributes); } - [Fact] - public void CanAddMultipleAttributes_IReadOnlyDictionaryString() - { - var attributes = new Dictionary - { - { "attribute1", "test1" }, - { "attribute2", "123" }, - { "attribute3", "456" }, - }; - - // Act & Assert - CanAddMultipleAttributesTest((IReadOnlyDictionary)attributes); - } - [Fact] public void CanAddMultipleAttributes_IReadOnlyDictionaryObject() { @@ -363,20 +335,6 @@ namespace Microsoft.AspNetCore.Components.Test CanAddMultipleAttributesTest((IReadOnlyDictionary)attributes); } - [Fact] - public void CanAddMultipleAttributes_ListKvpString() - { - var attributes = new List>() - { - new KeyValuePair("attribute1", "test1"), - new KeyValuePair("attribute2", "123"), - new KeyValuePair("attribute3", "456"), - }; - - // Act & Assert - CanAddMultipleAttributesTest(attributes); - } - [Fact] public void CanAddMultipleAttributes_ListKvpObject() { @@ -391,20 +349,6 @@ namespace Microsoft.AspNetCore.Components.Test CanAddMultipleAttributesTest(attributes); } - [Fact] - public void CanAddMultipleAttributes_ArrayKvpString() - { - var attributes = new KeyValuePair[] - { - new KeyValuePair("attribute1", "test1"), - new KeyValuePair("attribute2", "123"), - new KeyValuePair("attribute3", "456"), - }; - - // Act & Assert - CanAddMultipleAttributesTest(attributes); - } - [Fact] public void CanAddMultipleAttributes_ArrayKvpObject() { @@ -419,7 +363,7 @@ namespace Microsoft.AspNetCore.Components.Test CanAddMultipleAttributesTest(attributes); } - private void CanAddMultipleAttributesTest(IEnumerable> attributes) + private void CanAddMultipleAttributesTest(IEnumerable> attributes) { // Arrange var builder = new RenderTreeBuilder(new TestRenderer());