ModelAttributes Class¶
Provides access to the combined list of attributes associated a System.Type
or property.
- Namespace
Microsoft.AspNetCore.Mvc.ModelBinding
- Assemblies
- Microsoft.AspNetCore.Mvc.Core
Constructors¶
-
ModelAttributes
(System.Collections.Generic.IEnumerable<System.Object>)¶ Creates a new
Microsoft.AspNetCore.Mvc.ModelBinding.ModelAttributes
for aSystem.Type
.Arguments: typeAttributes (System.Collections.Generic.IEnumerable<System.Object>) – The set of attributes for the System.Type
.public ModelAttributes(IEnumerable<object> typeAttributes)
-
ModelAttributes
(System.Collections.Generic.IEnumerable<System.Object>, System.Collections.Generic.IEnumerable<System.Object>) Creates a new
Microsoft.AspNetCore.Mvc.ModelBinding.ModelAttributes
for a property.Arguments: - propertyAttributes (System.Collections.Generic.IEnumerable<System.Object>) – The set of attributes for the property.
- typeAttributes (System.Collections.Generic.IEnumerable<System.Object>) – The set of attributes for the property’s
System.Type
. SeeSystem.Reflection.PropertyInfo.PropertyType
.
public ModelAttributes(IEnumerable<object> propertyAttributes, IEnumerable<object> typeAttributes)
-
Properties¶
-
Microsoft.AspNetCore.Mvc.ModelBinding.ModelAttributes.
Attributes
¶ Gets the set of all attributes. If this instance represents the attributes for a property, the attributes on the property definition are before those on the property’s
System.Type
.Return type: System.Collections.Generic.IReadOnlyList<System.Object> public IReadOnlyList<object> Attributes { get; }
-
Microsoft.AspNetCore.Mvc.ModelBinding.ModelAttributes.
PropertyAttributes
¶ Gets the set of attributes on the property, or <code>null</code> if this instance represents the attributes for a
System.Type
.Return type: System.Collections.Generic.IReadOnlyList<System.Object> public IReadOnlyList<object> PropertyAttributes { get; }
-
Microsoft.AspNetCore.Mvc.ModelBinding.ModelAttributes.
TypeAttributes
¶ Gets the set of attributes on the
System.Type
. If this instance represents a property, thenMicrosoft.AspNetCore.Mvc.ModelBinding.ModelAttributes.TypeAttributes
contains attributes retrieved fromSystem.Reflection.PropertyInfo.PropertyType
.Return type: System.Collections.Generic.IReadOnlyList<System.Object> public IReadOnlyList<object> TypeAttributes { get; }
-
Methods¶
-
GetAttributesForProperty
(System.Type, System.Reflection.PropertyInfo)¶ Gets the attributes for the given <em>property</em>.
Arguments: - type (System.Type) – The
System.Type
in which caller found <em>property</em>. - property (System.Reflection.PropertyInfo) – A
System.Reflection.PropertyInfo
for which attributes need to be resolved.
Return type: Returns: A
Microsoft.AspNetCore.Mvc.ModelBinding.ModelAttributes
instance with the attributes of the property.public static ModelAttributes GetAttributesForProperty(Type type, PropertyInfo property)
- type (System.Type) – The
-
GetAttributesForType
(System.Type)¶ Gets the attributes for the given <em>type</em>.
Arguments: type (System.Type) – The System.Type
for which attributes need to be resolved.Return type: Microsoft.AspNetCore.Mvc.ModelBinding.ModelAttributes Returns: A Microsoft.AspNetCore.Mvc.ModelBinding.ModelAttributes
instance with the attributes of theSystem.Type
.public static ModelAttributes GetAttributesForType(Type type)
-