ModelAttributes Class¶
Summary¶
Provides access to the combined list of attributes associated a [System.Type]() or property.
Constructors¶
-
ModelAttributes
(System.Collections.Generic.IEnumerable<System.Object>)¶ Creates a new [Microsoft.AspNet.Mvc.ModelBinding.ModelAttributes](Microsoft.AspNet.Mvc.ModelBinding.ModelAttributes.yml) for a [System.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.AspNet.Mvc.ModelBinding.ModelAttributes](Microsoft.AspNet.Mvc.ModelBinding.ModelAttributes.yml) 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](). See [System.Reflection.PropertyInfo.PropertyType]().
public ModelAttributes(IEnumerable<object> propertyAttributes, IEnumerable<object> typeAttributes)
-
Properties¶
-
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; }
-
PropertyAttributes
()¶ Gets the set of attributes on the property, or <c>null</c> if this instance represents the attributes for a [System.Type]().
Return type: System.Collections.Generic.IReadOnlyList{System.Object} public IReadOnlyList<object> PropertyAttributes { get; }
-
TypeAttributes
()¶ Gets the set of attributes on the [System.Type](). If this instance represents a property, then [Microsoft.AspNet.Mvc.ModelBinding.ModelAttributes.TypeAttributes](Microsoft.AspNet.Mvc.ModelBinding.ModelAttributes.yml) contains attributes retrieved from [System.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 <paramref name=”property” />.
Arguments: - type (System.Type) – The [System.Type]() in which caller found <paramref name=”property” />.
- property (System.Reflection.PropertyInfo) – A [System.Reflection.PropertyInfo]() for which attributes need to be resolved.
Return type: Microsoft.AspNet.Mvc.ModelBinding.ModelAttributes
Returns: A [Microsoft.AspNet.Mvc.ModelBinding.ModelAttributes](Microsoft.AspNet.Mvc.ModelBinding.ModelAttributes.yml) instance with the attributes of the property.
public static ModelAttributes GetAttributesForProperty(Type type, PropertyInfo property)
-
GetAttributesForType
(System.Type)¶ Gets the attributes for the given <paramref name=”type” />.
Arguments: - type (System.Type) – The [System.Type]() for which attributes need to be resolved.
Return type: Microsoft.AspNet.Mvc.ModelBinding.ModelAttributes
Returns: A [Microsoft.AspNet.Mvc.ModelBinding.ModelAttributes](Microsoft.AspNet.Mvc.ModelBinding.ModelAttributes.yml) instance with the attributes of the [System.Type]().
public static ModelAttributes GetAttributesForType(Type type)
-