Show / Hide Table of Contents

Class OptionalStringLengthAttribute

Specifies the minimum and maximum length of characters that are allowed in a data field of type Optional<T>.

Inheritance
object
Attribute
ValidationAttribute
StringLengthAttribute
OptionalStringLengthAttribute
Inherited Members
StringLengthAttribute.FormatErrorMessage(string)
StringLengthAttribute.MaximumLength
StringLengthAttribute.MinimumLength
ValidationAttribute.GetValidationResult(object, ValidationContext)
ValidationAttribute.Validate(object, ValidationContext)
ValidationAttribute.Validate(object, string)
ValidationAttribute.ErrorMessage
ValidationAttribute.ErrorMessageResourceName
ValidationAttribute.ErrorMessageResourceType
ValidationAttribute.RequiresValidationContext
Attribute.Equals(object)
Attribute.GetCustomAttribute(Assembly, Type)
Attribute.GetCustomAttribute(Assembly, Type, bool)
Attribute.GetCustomAttribute(MemberInfo, Type)
Attribute.GetCustomAttribute(MemberInfo, Type, bool)
Attribute.GetCustomAttribute(Module, Type)
Attribute.GetCustomAttribute(Module, Type, bool)
Attribute.GetCustomAttribute(ParameterInfo, Type)
Attribute.GetCustomAttribute(ParameterInfo, Type, bool)
Attribute.GetCustomAttributes(Assembly)
Attribute.GetCustomAttributes(Assembly, bool)
Attribute.GetCustomAttributes(Assembly, Type)
Attribute.GetCustomAttributes(Assembly, Type, bool)
Attribute.GetCustomAttributes(MemberInfo)
Attribute.GetCustomAttributes(MemberInfo, bool)
Attribute.GetCustomAttributes(MemberInfo, Type)
Attribute.GetCustomAttributes(MemberInfo, Type, bool)
Attribute.GetCustomAttributes(Module)
Attribute.GetCustomAttributes(Module, bool)
Attribute.GetCustomAttributes(Module, Type)
Attribute.GetCustomAttributes(Module, Type, bool)
Attribute.GetCustomAttributes(ParameterInfo)
Attribute.GetCustomAttributes(ParameterInfo, bool)
Attribute.GetCustomAttributes(ParameterInfo, Type)
Attribute.GetCustomAttributes(ParameterInfo, Type, bool)
Attribute.GetHashCode()
Attribute.IsDefaultAttribute()
Attribute.IsDefined(Assembly, Type)
Attribute.IsDefined(Assembly, Type, bool)
Attribute.IsDefined(MemberInfo, Type)
Attribute.IsDefined(MemberInfo, Type, bool)
Attribute.IsDefined(Module, Type)
Attribute.IsDefined(Module, Type, bool)
Attribute.IsDefined(ParameterInfo, Type)
Attribute.IsDefined(ParameterInfo, Type, bool)
Attribute.Match(object)
Attribute.TypeId
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DotNext.ComponentModel.DataAnnotations
Assembly: DotNext.dll
Syntax
public sealed class OptionalStringLengthAttribute : StringLengthAttribute
Remarks

Initializes a new attribute.

Constructors

| Edit this page View Source

OptionalStringLengthAttribute(int)

Specifies the minimum and maximum length of characters that are allowed in a data field of type Optional<T>.

Declaration
public OptionalStringLengthAttribute(int maximumLength)
Parameters
Type Name Description
int maximumLength

The maximum length of a string.

Remarks

Initializes a new attribute.

Methods

| Edit this page View Source

IsValid(object?)

Determines whether a specified object is valid.

Declaration
public override bool IsValid(object? value)
Parameters
Type Name Description
object value

The object to validate.

Returns
Type Description
bool

true if the specified object is valid; otherwise, false.

Overrides
StringLengthAttribute.IsValid(object)
Exceptions
Type Condition
ArgumentOutOfRangeException

maximumLength is negative.

-or-

maximumLength is less than MinimumLength.

InvalidOperationException

The current attribute is ill-formed.

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.GetUserData<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
ExpressionBuilder.Const<T>(T)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾