Class PolicyResultBase<TMetadata>
- Namespace
- Motiv
- Assembly
- Motiv.dll
Represents a "policy result" whereby an arbitrary rule causes a single metadata instance to be returned.
public abstract class PolicyResultBase<TMetadata> : BooleanResultBase<TMetadata>, IEquatable<BooleanResultBase>, IEquatable<bool>
Type Parameters
TMetadata
- Inheritance
-
BooleanResultBase<TMetadata>PolicyResultBase<TMetadata>
- Implements
- Derived
- Inherited Members
- Extension Methods
Properties
Value
The single metadata instance that is returned by the policy.
public abstract TMetadata Value { get; }
Property Value
- TMetadata
Remarks
For a short-circuiting composition (OrElse(PolicyResultBase<TMetadata>) or AndAlso(PolicyResultBase<TMetadata>)) this value is a
selection — the last-evaluated operand's — and not a guarantee that only one cause exists.
When such a composition has more than one contributing cause, Values
reports all of them, so Value is not necessarily Values.Single().
Methods
AndAlso(PolicyResultBase<TMetadata>)
Performs a conditional AND operation between the current PolicyResultBase instance and another PolicyResultBase instance. The right operand does not contribute when the left operand is unsatisfied, since an unsatisfied left operand already determines the outcome.
public PolicyResultBase<TMetadata> AndAlso(PolicyResultBase<TMetadata> right)
Parameters
rightPolicyResultBase<TMetadata>The other policy result instance to perform the AND operation with.
Returns
- PolicyResultBase<TMetadata>
A new policy result instance representing the result of the AND operation.
Not()
Returns a new instance of Motiv.Not.NotPolicyResult<TMetadata> that represents the logical negation of the current instance.
public PolicyResultBase<TMetadata> Not()
Returns
- PolicyResultBase<TMetadata>
A new instance of Motiv.Not.NotBooleanOperationResult<TMetadata> that represents the logical negation of the current instance.
OrElse(PolicyResultBase<TMetadata>)
Performs a conditional OR operation between the current PolicyResultBase instance and another PolicyResultBase instance. This will short-circuit the evaluation of the right operand if the left operand is satisfied.
public PolicyResultBase<TMetadata> OrElse(PolicyResultBase<TMetadata> right)
Parameters
rightPolicyResultBase<TMetadata>The other policy result instance to perform the OR operation with.
Returns
- PolicyResultBase<TMetadata>
A new policy result instance representing the result of the OR operation.
Operators
operator !(PolicyResultBase<TMetadata>)
Creates a new PolicyResultBase<TMetadata> that is equivalent to a logical "NOT" of the current policy.
public static PolicyResultBase<TMetadata> operator !(PolicyResultBase<TMetadata> policyResult)
Parameters
policyResultPolicyResultBase<TMetadata>The policy to negate
Returns
- PolicyResultBase<TMetadata>
A new PolicyBase<TModel, TMetadata> that will perform the "Not" operation when evaluated.