Class IntegerInRange
A validation rule which passes if the validated integer or System.Nullable<T> integer is within an inclusive
Min & Max range. This rule works with all of the CLR-standard integer types.
Inheritance
System.Object
IntegerInRange
Implements
IRule<
System.Nullable<
System.Byte>>
IRule<
System.Nullable<
System.Int16>>
IRule<
System.Nullable<
System.Int32>>
IRule<
System.Nullable<
System.Int64>>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: CSF.Validation.StandardRules.dll
Syntax
public class IntegerInRange : IRuleWithMessage<byte>, IRule<byte>, IGetsFailureMessage<byte>, IRuleWithMessage<short>, IRule<short>, IGetsFailureMessage<short>, IRuleWithMessage<int>, IRule<int>, IGetsFailureMessage<int>, IRuleWithMessage<long>, IRule<long>, IGetsFailureMessage<long>, IRuleWithMessage<byte?>, IRule<byte?>, IGetsFailureMessage<byte?>, IRuleWithMessage<short?>, IRule<short?>, IGetsFailureMessage<short?>, IRuleWithMessage<int?>, IRule<int?>, IGetsFailureMessage<int?>, IRuleWithMessage<long?>, IRule<long?>, IGetsFailureMessage<long?>
Properties
|
Improve this Doc
View Source
Max
Gets or sets the (inclusive) maximum for the validated value.
Declaration
public long? Max { get; set; }
Property Value
Type |
Description |
System.Nullable<System.Int64> |
|
|
Improve this Doc
View Source
Min
Gets or sets the (inclusive) minimum for the validated value.
Declaration
public long? Min { get; set; }
Property Value
Type |
Description |
System.Nullable<System.Int64> |
|
Methods
|
Improve this Doc
View Source
GetFailureMessageAsync(Nullable<Int64>, ValidationRuleResult, CancellationToken)
Gets the validation failure message for the specified result.
Declaration
public ValueTask<string> GetFailureMessageAsync(long? value, ValidationRuleResult result, CancellationToken token = default(CancellationToken))
Parameters
Type |
Name |
Description |
System.Nullable<System.Int64> |
value |
|
ValidationRuleResult |
result |
A validation result, typically indicating failure.
|
System.Threading.CancellationToken |
token |
An optional cancellation token.
|
Returns
Type |
Description |
System.Threading.Tasks.ValueTask<System.String> |
A human-readable message.
|
|
Improve this Doc
View Source
GetResultAsync(Int64, RuleContext, CancellationToken)
Performs the validation logic asynchronously and returns a task of RuleResult.
Declaration
public ValueTask<RuleResult> GetResultAsync(long validated, RuleContext context, CancellationToken token = default(CancellationToken))
Parameters
Type |
Name |
Description |
System.Int64 |
validated |
|
RuleContext |
context |
Contextual information about the validation
|
System.Threading.CancellationToken |
token |
An object which may be used to cancel the process
|
Returns
Type |
Description |
System.Threading.Tasks.ValueTask<RuleResult> |
A task which provides a result object, indicating the result of validation
|
Exceptions
Type |
Condition |
System.Exception |
This method may raise any exception type
|
|
Improve this Doc
View Source
GetResultAsync(Nullable<Int64>, RuleContext, CancellationToken)
Performs the validation logic asynchronously and returns a task of RuleResult.
Declaration
public ValueTask<RuleResult> GetResultAsync(long? validated, RuleContext context, CancellationToken token = default(CancellationToken))
Parameters
Type |
Name |
Description |
System.Nullable<System.Int64> |
validated |
|
RuleContext |
context |
Contextual information about the validation
|
System.Threading.CancellationToken |
token |
An object which may be used to cancel the process
|
Returns
Type |
Description |
System.Threading.Tasks.ValueTask<RuleResult> |
A task which provides a result object, indicating the result of validation
|
Exceptions
Type |
Condition |
System.Exception |
This method may raise any exception type
|
Explicit Interface Implementations
|
Improve this Doc
View Source
IGetsFailureMessage<Nullable<Byte>>.GetFailureMessageAsync(Nullable<Byte>, ValidationRuleResult, CancellationToken)
Declaration
ValueTask<string> IGetsFailureMessage<byte?>.GetFailureMessageAsync(byte? value, ValidationRuleResult result, CancellationToken token)
Parameters
Type |
Name |
Description |
System.Nullable<System.Byte> |
value |
|
ValidationRuleResult |
result |
|
System.Threading.CancellationToken |
token |
|
Returns
Type |
Description |
System.Threading.Tasks.ValueTask<System.String> |
|
|
Improve this Doc
View Source
IGetsFailureMessage<Byte>.GetFailureMessageAsync(Byte, ValidationRuleResult, CancellationToken)
Declaration
ValueTask<string> IGetsFailureMessage<byte>.GetFailureMessageAsync(byte value, ValidationRuleResult result, CancellationToken token)
Parameters
Type |
Name |
Description |
System.Byte |
value |
|
ValidationRuleResult |
result |
|
System.Threading.CancellationToken |
token |
|
Returns
Type |
Description |
System.Threading.Tasks.ValueTask<System.String> |
|
|
Improve this Doc
View Source
IGetsFailureMessage<Nullable<Int16>>.GetFailureMessageAsync(Nullable<Int16>, ValidationRuleResult, CancellationToken)
Declaration
ValueTask<string> IGetsFailureMessage<short?>.GetFailureMessageAsync(short? value, ValidationRuleResult result, CancellationToken token)
Parameters
Type |
Name |
Description |
System.Nullable<System.Int16> |
value |
|
ValidationRuleResult |
result |
|
System.Threading.CancellationToken |
token |
|
Returns
Type |
Description |
System.Threading.Tasks.ValueTask<System.String> |
|
|
Improve this Doc
View Source
IGetsFailureMessage<Int16>.GetFailureMessageAsync(Int16, ValidationRuleResult, CancellationToken)
Declaration
ValueTask<string> IGetsFailureMessage<short>.GetFailureMessageAsync(short value, ValidationRuleResult result, CancellationToken token)
Parameters
Type |
Name |
Description |
System.Int16 |
value |
|
ValidationRuleResult |
result |
|
System.Threading.CancellationToken |
token |
|
Returns
Type |
Description |
System.Threading.Tasks.ValueTask<System.String> |
|
|
Improve this Doc
View Source
IGetsFailureMessage<Nullable<Int32>>.GetFailureMessageAsync(Nullable<Int32>, ValidationRuleResult, CancellationToken)
Declaration
ValueTask<string> IGetsFailureMessage<int?>.GetFailureMessageAsync(int? value, ValidationRuleResult result, CancellationToken token)
Parameters
Type |
Name |
Description |
System.Nullable<System.Int32> |
value |
|
ValidationRuleResult |
result |
|
System.Threading.CancellationToken |
token |
|
Returns
Type |
Description |
System.Threading.Tasks.ValueTask<System.String> |
|
|
Improve this Doc
View Source
IGetsFailureMessage<Int32>.GetFailureMessageAsync(Int32, ValidationRuleResult, CancellationToken)
Declaration
ValueTask<string> IGetsFailureMessage<int>.GetFailureMessageAsync(int value, ValidationRuleResult result, CancellationToken token)
Parameters
Type |
Name |
Description |
System.Int32 |
value |
|
ValidationRuleResult |
result |
|
System.Threading.CancellationToken |
token |
|
Returns
Type |
Description |
System.Threading.Tasks.ValueTask<System.String> |
|
|
Improve this Doc
View Source
IGetsFailureMessage<Int64>.GetFailureMessageAsync(Int64, ValidationRuleResult, CancellationToken)
Declaration
ValueTask<string> IGetsFailureMessage<long>.GetFailureMessageAsync(long value, ValidationRuleResult result, CancellationToken token)
Parameters
Type |
Name |
Description |
System.Int64 |
value |
|
ValidationRuleResult |
result |
|
System.Threading.CancellationToken |
token |
|
Returns
Type |
Description |
System.Threading.Tasks.ValueTask<System.String> |
|
|
Improve this Doc
View Source
IRule<Nullable<Byte>>.GetResultAsync(Nullable<Byte>, RuleContext, CancellationToken)
Declaration
ValueTask<RuleResult> IRule<byte?>.GetResultAsync(byte? validated, RuleContext context, CancellationToken token)
Parameters
Type |
Name |
Description |
System.Nullable<System.Byte> |
validated |
|
RuleContext |
context |
|
System.Threading.CancellationToken |
token |
|
Returns
Type |
Description |
System.Threading.Tasks.ValueTask<RuleResult> |
|
|
Improve this Doc
View Source
IRule<Byte>.GetResultAsync(Byte, RuleContext, CancellationToken)
Declaration
ValueTask<RuleResult> IRule<byte>.GetResultAsync(byte validated, RuleContext context, CancellationToken token)
Parameters
Type |
Name |
Description |
System.Byte |
validated |
|
RuleContext |
context |
|
System.Threading.CancellationToken |
token |
|
Returns
Type |
Description |
System.Threading.Tasks.ValueTask<RuleResult> |
|
|
Improve this Doc
View Source
IRule<Nullable<Int16>>.GetResultAsync(Nullable<Int16>, RuleContext, CancellationToken)
Declaration
ValueTask<RuleResult> IRule<short?>.GetResultAsync(short? validated, RuleContext context, CancellationToken token)
Parameters
Type |
Name |
Description |
System.Nullable<System.Int16> |
validated |
|
RuleContext |
context |
|
System.Threading.CancellationToken |
token |
|
Returns
Type |
Description |
System.Threading.Tasks.ValueTask<RuleResult> |
|
|
Improve this Doc
View Source
IRule<Int16>.GetResultAsync(Int16, RuleContext, CancellationToken)
Declaration
ValueTask<RuleResult> IRule<short>.GetResultAsync(short validated, RuleContext context, CancellationToken token)
Parameters
Type |
Name |
Description |
System.Int16 |
validated |
|
RuleContext |
context |
|
System.Threading.CancellationToken |
token |
|
Returns
Type |
Description |
System.Threading.Tasks.ValueTask<RuleResult> |
|
|
Improve this Doc
View Source
IRule<Nullable<Int32>>.GetResultAsync(Nullable<Int32>, RuleContext, CancellationToken)
Declaration
ValueTask<RuleResult> IRule<int?>.GetResultAsync(int? validated, RuleContext context, CancellationToken token)
Parameters
Type |
Name |
Description |
System.Nullable<System.Int32> |
validated |
|
RuleContext |
context |
|
System.Threading.CancellationToken |
token |
|
Returns
Type |
Description |
System.Threading.Tasks.ValueTask<RuleResult> |
|
|
Improve this Doc
View Source
IRule<Int32>.GetResultAsync(Int32, RuleContext, CancellationToken)
Declaration
ValueTask<RuleResult> IRule<int>.GetResultAsync(int validated, RuleContext context, CancellationToken token)
Parameters
Type |
Name |
Description |
System.Int32 |
validated |
|
RuleContext |
context |
|
System.Threading.CancellationToken |
token |
|
Returns
Type |
Description |
System.Threading.Tasks.ValueTask<RuleResult> |
|
Implements