Class ValidationExtensions
- Namespace
- Acuit.Pinpoint.Workflows.Validation
- Assembly
- Acuit.Pinpoint.Workflows.dll
Helper extensions for evaluating and validating workflow argument properties.
public static class ValidationExtensions
- Inheritance
-
ValidationExtensions
- Inherited Members
Methods
EvaluateOptionalArgumentAsync(ActivityContext, ValueSource, CancellationToken)
Evaluates an optional workflow argument.
public static Task<object> EvaluateOptionalArgumentAsync(this ActivityContext context, ValueSource argument, CancellationToken cancellationToken)
Parameters
contextActivityContextThe activity context.
argumentValueSourceThe value source.
cancellationTokenCancellationTokenA token that can request canceling evaluating the value.
Returns
- Task<object>
A task that represents the asynchronous operation. The value of its Result property contains the resulting value, or null if
argumentis null.
Exceptions
- ArgumentNullException
contextis null.- Exception
The workflow argument value source could not be evaluated.
EvaluateOptionalArgumentAsync<T>(ActivityContext, ValueSource<T>, CancellationToken)
Evaluates an optional workflow argument.
public static Task<T> EvaluateOptionalArgumentAsync<T>(this ActivityContext context, ValueSource<T> argument, CancellationToken cancellationToken)
Parameters
contextActivityContextThe activity context.
argumentValueSource<T>The value source.
cancellationTokenCancellationTokenA token that can request canceling evaluating the value.
Returns
- Task<T>
A task that represents the asynchronous operation. The value of its Result property contains the resulting value, or the default value for
Tifargumentis null.
Type Parameters
TThe value type.
Exceptions
- ArgumentNullException
contextis null.- Exception
The workflow argument value source could not be evaluated.
EvaluateRequiredArgumentAsync(ActivityContext, ValueSource, string, CancellationToken)
Evaluates a required workflow argument.
public static Task<object> EvaluateRequiredArgumentAsync(this ActivityContext context, ValueSource argument, string propertyName, CancellationToken cancellationToken)
Parameters
contextActivityContextThe activity context.
argumentValueSourceThe value source.
propertyNamestringThe workflow argument property name, which will be used in error exception messages.
cancellationTokenCancellationTokenA token that can request canceling evaluating the value.
Returns
- Task<object>
A task that represents the asynchronous operation. The value of its Result property contains the resulting value.
Remarks
This simply confirms that the workflow argument property has been assigned a value source, and evaluates that value source, which could yield null, for example.
Exceptions
- ArgumentNullException
contextis null.- ArgumentNullException
propertyNameis null.- InvalidOperationException
The property is required.
- Exception
The workflow argument value source could not be evaluated.
EvaluateRequiredArgumentAsync<T>(ActivityContext, ValueSource<T>, string, CancellationToken)
Evaluates a required workflow argument.
public static Task<T> EvaluateRequiredArgumentAsync<T>(this ActivityContext context, ValueSource<T> argument, string propertyName, CancellationToken cancellationToken)
Parameters
contextActivityContextThe activity context.
argumentValueSource<T>The value source.
propertyNamestringThe workflow argument property name, which will be used in error exception messages.
cancellationTokenCancellationTokenA token that can request canceling evaluating the value.
Returns
- Task<T>
A task that represents the asynchronous operation. The value of its Result property contains the resulting value.
Type Parameters
TThe value type.
Remarks
This simply confirms that the workflow argument property has been assigned a value source, and evaluates that value source, which could yield null, for example.
Exceptions
- ArgumentNullException
contextis null.- ArgumentNullException
propertyNameis null.- InvalidOperationException
The property is required.
- Exception
The workflow argument value source could not be evaluated.
ValidateOptionalArgumentAsync(ActivityContext, ValueSource, string, CancellationToken)
Evaluates an optional workflow argument, allowing fluent validation to be performed on the resulting value.
public static Task<ArgumentValidator<object>> ValidateOptionalArgumentAsync(this ActivityContext context, ValueSource argument, string propertyName, CancellationToken cancellationToken)
Parameters
contextActivityContextThe activity context.
argumentValueSourceThe value source.
propertyNamestringThe workflow argument property name, which will be used in error exception messages.
cancellationTokenCancellationTokenA token that can request canceling evaluating the value.
Returns
- Task<ArgumentValidator<object>>
A task that represents the asynchronous operation. The value of its Result property contains an ArgumentValidator<T> with which fluent validation can be performed and the resulting value can be obtained.
Remarks
If argument is null, then null will be assumed for the evaluated value.
ArgumentValidator<T> validation extension methods should be used to validate the resulting value.
Note that fluent validation is always performed, even if argument is null.
See the remarks for ArgumentValidator<T> for additional information about fluent validation.
Exceptions
- ArgumentNullException
contextis null.- ArgumentNullException
propertyNameis null.- Exception
The workflow argument value source could not be evaluated.
ValidateOptionalArgumentAsync<T>(ActivityContext, ValueSource<T>, string, CancellationToken)
Evaluates an optional workflow argument, allowing fluent validation to be performed on the resulting value.
public static Task<ArgumentValidator<T>> ValidateOptionalArgumentAsync<T>(this ActivityContext context, ValueSource<T> argument, string propertyName, CancellationToken cancellationToken)
Parameters
contextActivityContextThe activity context.
argumentValueSource<T>The value source.
propertyNamestringThe workflow argument property name, which will be used in error exception messages.
cancellationTokenCancellationTokenA token that can request canceling evaluating the value.
Returns
- Task<ArgumentValidator<T>>
A task that represents the asynchronous operation. The value of its Result property contains an ArgumentValidator<T> with which fluent validation can be performed and the resulting value can be obtained.
Type Parameters
TThe value type.
Remarks
If argument is null, then the default value for T will be assumed for the evaluated value.
ArgumentValidator<T> validation extension methods should be used to validate the resulting value.
Note that fluent validation is always performed, even if argument is null.
See the remarks for ArgumentValidator<T> for additional information about fluent validation.
Exceptions
- ArgumentNullException
contextis null.- ArgumentNullException
propertyNameis null.- Exception
The workflow argument value source could not be evaluated.
ValidateRequiredArgumentAsync(ActivityContext, ValueSource, string, CancellationToken)
Evaluates a required workflow argument, allowing fluent validation to be performed on the resulting value.
public static Task<ArgumentValidator<object>> ValidateRequiredArgumentAsync(this ActivityContext context, ValueSource argument, string propertyName, CancellationToken cancellationToken)
Parameters
contextActivityContextThe activity context.
argumentValueSourceThe value source.
propertyNamestringThe workflow argument property name, which will be used in error exception messages.
cancellationTokenCancellationTokenA token that can request canceling evaluating the value.
Returns
- Task<ArgumentValidator<object>>
A task that represents the asynchronous operation. The value of its Result property contains an ArgumentValidator<T> with which fluent validation can be performed and the resulting value can be obtained.
Remarks
This simply confirms that the workflow argument property has been assigned a value source, and evaluates that value source, which could yield a null value, for example. ArgumentValidator<T> validation extension methods should be used to validate the resulting value.
See the remarks for ArgumentValidator<T> for additional information about fluent validation.
Exceptions
- ArgumentNullException
contextis null.- ArgumentNullException
propertyNameis null.- InvalidOperationException
The property is required.
- Exception
The workflow argument value source could not be evaluated.
ValidateRequiredArgumentAsync<T>(ActivityContext, ValueSource<T>, string, CancellationToken)
Evaluates a required workflow argument, allowing fluent validation to be performed on the resulting value.
public static Task<ArgumentValidator<T>> ValidateRequiredArgumentAsync<T>(this ActivityContext context, ValueSource<T> argument, string propertyName, CancellationToken cancellationToken)
Parameters
contextActivityContextThe activity context.
argumentValueSource<T>The value source.
propertyNamestringThe workflow argument property name, which will be used in error exception messages.
cancellationTokenCancellationTokenA token that can request canceling evaluating the value.
Returns
- Task<ArgumentValidator<T>>
A task that represents the asynchronous operation. The value of its Result property contains an ArgumentValidator<T> with which fluent validation can be performed and the resulting value can be obtained.
Type Parameters
TThe value type.
Remarks
This simply confirms that the workflow argument property has been assigned a value source, and evaluates that value source, which could yield a null value, for example. ArgumentValidator<T> validation extension methods should be used to validate the resulting value.
See the remarks for ArgumentValidator<T> for additional information about fluent validation.
Exceptions
- ArgumentNullException
contextis null.- ArgumentNullException
propertyNameis null.- InvalidOperationException
The property is required.
- Exception
The workflow argument value source could not be evaluated.