Table of Contents

Class FailureScenarioThrowingConstraint

Namespace
ReferenceApplication.Web.Governance.FailureScenarios
Assembly
ReferenceApplication.Web.dll

A Development-only demonstration constraint that throws during policy evaluation when its scenario is armed for the request, and otherwise does not apply.

public sealed class FailureScenarioThrowingConstraint : IGovernanceConstraint<GovernanceEvaluationContext>
Inheritance
FailureScenarioThrowingConstraint
Implements
IGovernanceConstraint<GovernanceEvaluationContext>
Inherited Members

Remarks

It is registered only by AddApplicationFailureScenarios, which registers nothing outside Development.

Constructors

FailureScenarioThrowingConstraint(IHttpContextAccessor, FailureScenarioRegistry)

A Development-only demonstration constraint that throws during policy evaluation when its scenario is armed for the request, and otherwise does not apply.

public FailureScenarioThrowingConstraint(IHttpContextAccessor httpContextAccessor, FailureScenarioRegistry registry)

Parameters

httpContextAccessor IHttpContextAccessor

The current request accessor.

registry FailureScenarioRegistry

The run registry.

Remarks

It is registered only by AddApplicationFailureScenarios, which registers nothing outside Development.

Fields

ConstraintName

Gets the stable name of this constraint.

public const string ConstraintName = "referenceapplication.failure_scenarios.throwing_constraint"

Field Value

string

Properties

Name

Gets the stable name of the constraint.

public string Name { get; }

Property Value

string

Methods

EvaluateAsync(GovernanceEvaluationContext, CancellationToken)

Evaluates the constraint for the supplied context.

public ValueTask<ConstraintEvaluationResult> EvaluateAsync(GovernanceEvaluationContext context, CancellationToken cancellationToken = default)

Parameters

context GovernanceEvaluationContext

The context to evaluate.

cancellationToken CancellationToken

A token that can cancel asynchronous evaluation.

Returns

ValueTask<ConstraintEvaluationResult>

The constraint evaluation result.