Table of Contents

Class PolicySimulatorServiceExtensions

Namespace
ReferenceApplication.Web.Extensions
Assembly
ReferenceApplication.Web.dll

Registers and maps the explicitly enabled, Development-only governance policy simulator.

public static class PolicySimulatorServiceExtensions
Inheritance
PolicySimulatorServiceExtensions
Inherited Members

Fields

EvaluatePath

Gets the route that evaluates a simulation.

public const string EvaluatePath = "/api/v1/policy-simulator/evaluate"

Field Value

string

Methods

AddApplicationPolicySimulator(IServiceCollection, IConfiguration, IHostEnvironment)

Registers the simulator only when its switch is enabled in Development.

public static IServiceCollection AddApplicationPolicySimulator(this IServiceCollection services, IConfiguration configuration, IHostEnvironment environment)

Parameters

services IServiceCollection

The service collection to configure.

configuration IConfiguration

The application configuration.

environment IHostEnvironment

The host environment.

Returns

IServiceCollection

The same service collection so calls can be chained.

Remarks

Call after AddApplicationAsiBackbone and AddApplicationCapabilityTokens: the simulator composes the constraints, decision policy, and capability validator they register.

IsActive(IConfiguration, IHostEnvironment)

Determines whether the feature switch is enabled in the Development environment.

public static bool IsActive(IConfiguration configuration, IHostEnvironment environment)

Parameters

configuration IConfiguration

The application configuration.

environment IHostEnvironment

The host environment.

Returns

bool

true when the simulator is active.

MapApplicationPolicySimulator(WebApplication)

Maps the administrator-only evaluation route only for an active Development simulator.

public static WebApplication MapApplicationPolicySimulator(this WebApplication app)

Parameters

app WebApplication

The application.

Returns

WebApplication

The same application so calls can be chained.