Skip to content
ModularityKit.Mutator ModularityKit.Mutator Docs
  • Home
  • Core
  • Governance
  • Redis
  • API
Search Results for

    Show / Hide Table of Contents

    Interface IMutationPolicy<TState>

    Represents policy that decides whether a mutation can be applied. Policies are FIRST CLASS governance mechanism in the mutation framework.

    Namespace: ModularityKit.Mutator.Abstractions.Policies
    Assembly: ModularityKit.Mutator.dll
    Syntax
    public interface IMutationPolicy<TState>
    Type Parameters
    Name Description
    TState

    Type of the state the mutation operates on.

    Properties

    | Edit this page View Source

    Description

    Optional description of the policy.

    Declaration
    string? Description { get; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Name

    The name of the policy.

    Declaration
    string Name { get; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Priority

    Priority of the policy evaluation. Higher values are evaluated earlier.

    Declaration
    int Priority { get; }
    Property Value
    Type Description
    int

    Methods

    | Edit this page View Source

    Evaluate(IMutation<TState>, TState)

    Evaluates whether the given mutation is allowed on the current state.

    Declaration
    PolicyDecision Evaluate(IMutation<TState> mutation, TState state)
    Parameters
    Type Name Description
    IMutation<TState> mutation

    The mutation to evaluate.

    TState state

    The current state before applying the mutation.

    Returns
    Type Description
    PolicyDecision

    A PolicyDecision representing the result of the evaluation.

    | Edit this page View Source

    EvaluateAsync(IMutation<TState>, TState, CancellationToken)

    Evaluates whether the given mutation is allowed on the current state asynchronously.

    Declaration
    Task<PolicyDecision> EvaluateAsync(IMutation<TState> mutation, TState state, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IMutation<TState> mutation

    The mutation to evaluate.

    TState state

    The current state before applying the mutation.

    CancellationToken cancellationToken

    Token used to cancel the policy evaluation.

    Returns
    Type Description
    Task<PolicyDecision>

    A PolicyDecision representing the result of the evaluation.

    • Edit this page
    • View Source
    In this article
    ModularityKit.Mutator Generated from XML docs and published from main. Back to top