MaxLengthAttribute Class
Specifies the maximum length of array or string data allowed in a property.
Inheritance Hierarchy
System.Object
System.Attribute
System.ComponentModel.DataAnnotations.ValidationAttribute
System.ComponentModel.DataAnnotations.MaxLengthAttribute
Namespace: System.ComponentModel.DataAnnotations
Assembly: EntityFramework (in EntityFramework.dll)
Syntax
'Declaration
<AttributeUsageAttribute(AttributeTargets.Property Or AttributeTargets.Field Or AttributeTargets.Parameter, AllowMultiple := False)> _
Public Class MaxLengthAttribute _
Inherits ValidationAttribute
'Usage
Dim instance As MaxLengthAttribute
[AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter, AllowMultiple = false)]
public class MaxLengthAttribute : ValidationAttribute
[AttributeUsageAttribute(AttributeTargets::Property|AttributeTargets::Field|AttributeTargets::Parameter, AllowMultiple = false)]
public ref class MaxLengthAttribute : public ValidationAttribute
[<AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter, AllowMultiple = false)>]
type MaxLengthAttribute =
class
inherit ValidationAttribute
end
public class MaxLengthAttribute extends ValidationAttribute
The MaxLengthAttribute type exposes the following members.
Constructors
Name | Description | |
---|---|---|
MaxLengthAttribute() | Initializes a new instance of the MaxLengthAttribute class. The maximum allowable length supported by the database will be used. | |
MaxLengthAttribute(Int32) | Initializes a new instance of the MaxLengthAttribute class. |
Top
Properties
Name | Description | |
---|---|---|
ErrorMessage | (Inherited from ValidationAttribute.) | |
ErrorMessageResourceName | (Inherited from ValidationAttribute.) | |
ErrorMessageResourceType | (Inherited from ValidationAttribute.) | |
ErrorMessageString | (Inherited from ValidationAttribute.) | |
Length | Gets the maximum allowable length of the array/string data. | |
RequiresValidationContext | (Inherited from ValidationAttribute.) | |
TypeId | (Inherited from Attribute.) |
Top
Methods
Name | Description | |
---|---|---|
Equals | (Inherited from Attribute.) | |
Finalize | (Inherited from Object.) | |
FormatErrorMessage | Applies formatting to a specified error message. (Overrides <see cref="M:System.ComponentModel.DataAnnotations.ValidationAttribute.FormatErrorMessage(System.String)" />) (Overrides ValidationAttribute.FormatErrorMessage(String).) | |
GetHashCode | (Inherited from Attribute.) | |
GetType | (Inherited from Object.) | |
GetValidationResult | (Inherited from ValidationAttribute.) | |
IsDefaultAttribute | (Inherited from Attribute.) | |
IsValid(Object) | Determines whether a specified object is valid. (Overrides <see cref="M:System.ComponentModel.DataAnnotations.ValidationAttribute.IsValid(System.Object)" />) (Overrides ValidationAttribute.IsValid(Object).) | |
IsValid(Object, ValidationContext) | (Inherited from ValidationAttribute.) | |
Match | (Inherited from Attribute.) | |
MemberwiseClone | (Inherited from Object.) | |
ToString | (Inherited from Object.) | |
Validate(Object, String) | (Inherited from ValidationAttribute.) | |
Validate(Object, ValidationContext) | (Inherited from ValidationAttribute.) |
Top
Explicit Interface Implementations
Name | Description | |
---|---|---|
_Attribute.GetIDsOfNames | (Inherited from Attribute.) | |
_Attribute.GetTypeInfo | (Inherited from Attribute.) | |
_Attribute.GetTypeInfoCount | (Inherited from Attribute.) | |
_Attribute.Invoke | (Inherited from Attribute.) |
Top
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also
Reference
System.ComponentModel.DataAnnotations Namespace