Table of Contents

Class PolicyExtensions

Namespace
Motiv
Assembly
Motiv.dll

Extension methods for Policy<TModel, TMetadata>.

public static class PolicyExtensions
Inheritance
PolicyExtensions
Inherited Members

Methods

AndAlsoTogether<TModel, TMetadata>(IEnumerable<PolicyBase<TModel, TMetadata>>)

Combines a collection of PolicyBase<TModel, TMetadata> whereby the enumeration of the policies halts at the first policy that is unsatisfied, whose false metadata is returned. If every policy is satisfied, the last policy's true metadata is returned. This is equivalent to combining the policies using the AndAlso(PolicyBase<TModel, TMetadata>) method.

public static PolicyBase<TModel, TMetadata> AndAlsoTogether<TModel, TMetadata>(this IEnumerable<PolicyBase<TModel, TMetadata>> propositions)

Parameters

propositions IEnumerable<PolicyBase<TModel, TMetadata>>

The propositions to apply the conditional AND operator to.

Returns

PolicyBase<TModel, TMetadata>

A single policy that represents the conditional AND of all the input propositions.

Type Parameters

TModel

The type of the model.

TMetadata

The type of the metadata.

OrElseTogether<TModel, TMetadata>(IEnumerable<PolicyBase<TModel, TMetadata>>)

Combines a collection of PolicyBase<TModel, TMetadata> whereby the enumeration of the policies halts at the first policy that is satisfied. If no policies are satisfied, the last policy's false metadata is returned. This is equivalent to combining the policies using the OrElse(PolicyBase<TModel, TMetadata>) method.

public static PolicyBase<TModel, TMetadata> OrElseTogether<TModel, TMetadata>(this IEnumerable<PolicyBase<TModel, TMetadata>> propositions)

Parameters

propositions IEnumerable<PolicyBase<TModel, TMetadata>>

The propositions to apply the ELSE operator to.

Returns

PolicyBase<TModel, TMetadata>

A single policy that represents the conditional OR of all the input propositions.

Type Parameters

TModel

The type of the model.

TMetadata

The type of the metadata.