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
Methods
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.