diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/ModelAttributes.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/ModelAttributes.cs index 019d37a6af..a6a7c3d5b1 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/ModelAttributes.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/ModelAttributes.cs @@ -77,9 +77,6 @@ namespace Microsoft.AspNet.Mvc.ModelBinding if (metadataProperty != null) { propertyAttributes = propertyAttributes.Concat(metadataProperty.GetCustomAttributes()); - - var propertyMetadataType = metadataProperty.PropertyType; - typeAttributes = typeAttributes.Concat(propertyMetadataType.GetTypeInfo().GetCustomAttributes()); } } diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/ModelAttributesTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/ModelAttributesTest.cs index 5aae1584a0..8fc67160b2 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/ModelAttributesTest.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/ModelAttributesTest.cs @@ -165,19 +165,17 @@ namespace Microsoft.AspNet.Mvc.ModelBinding var attributes = ModelAttributes.GetAttributesForProperty(typeof(MergedAttributes), property); // Assert - Assert.Equal(4, attributes.Attributes.Count); + Assert.Equal(3, attributes.Attributes.Count); Assert.IsType(attributes.Attributes[0]); Assert.IsType(attributes.Attributes[1]); Assert.IsType(attributes.Attributes[2]); - Assert.IsType(attributes.Attributes[3]); Assert.Equal(2, attributes.PropertyAttributes.Count); Assert.IsType(attributes.PropertyAttributes[0]); Assert.IsType(attributes.PropertyAttributes[1]); - Assert.Equal(2, attributes.TypeAttributes.Count); - Assert.IsType(attributes.TypeAttributes[0]); - Assert.IsType(attributes.TypeAttributes[1]); + var attribute = Assert.Single(attributes.TypeAttributes); + Assert.IsType(attribute); } [ClassValidator] @@ -207,7 +205,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding [Range(10,100)] public override int VirtualProperty { get; set; } - + } [ModelMetadataType(typeof(BaseModel))]