Table of Contents

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

context ActivityContext

The activity context.

argument ValueSource

The value source.

cancellationToken CancellationToken

A 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 argument is null.

Exceptions

ArgumentNullException

context is 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

context ActivityContext

The activity context.

argument ValueSource<T>

The value source.

cancellationToken CancellationToken

A 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 T if argument is null.

Type Parameters

T

The value type.

Exceptions

ArgumentNullException

context is 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

context ActivityContext

The activity context.

argument ValueSource

The value source.

propertyName string

The workflow argument property name, which will be used in error exception messages.

cancellationToken CancellationToken

A 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

context is null.

ArgumentNullException

propertyName is 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

context ActivityContext

The activity context.

argument ValueSource<T>

The value source.

propertyName string

The workflow argument property name, which will be used in error exception messages.

cancellationToken CancellationToken

A 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

T

The 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

context is null.

ArgumentNullException

propertyName is 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

context ActivityContext

The activity context.

argument ValueSource

The value source.

propertyName string

The workflow argument property name, which will be used in error exception messages.

cancellationToken CancellationToken

A 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

context is null.

ArgumentNullException

propertyName is 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

context ActivityContext

The activity context.

argument ValueSource<T>

The value source.

propertyName string

The workflow argument property name, which will be used in error exception messages.

cancellationToken CancellationToken

A 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

T

The 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

context is null.

ArgumentNullException

propertyName is 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

context ActivityContext

The activity context.

argument ValueSource

The value source.

propertyName string

The workflow argument property name, which will be used in error exception messages.

cancellationToken CancellationToken

A 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

context is null.

ArgumentNullException

propertyName is 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

context ActivityContext

The activity context.

argument ValueSource<T>

The value source.

propertyName string

The workflow argument property name, which will be used in error exception messages.

cancellationToken CancellationToken

A 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

T

The 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

context is null.

ArgumentNullException

propertyName is null.

InvalidOperationException

The property is required.

Exception

The workflow argument value source could not be evaluated.