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

    Show / Hide Table of Contents

    Interface IMutation<TState>

    Represents a mutation operation that can be applied to a given state of type TState.

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

    The type of state the mutation operates on.

    Remarks

    The IMutation<TState> interface defines the contract for a mutation: what change is being performed (Intent), the execution context (Context), and the operations to apply, validate, or simulate the mutation.

    For simpler implementations, MutationBase<TState> provides default behavior for validation and simulation.

    Typical usage involves:

    • Creating a mutation instance with a descriptive Intent.
    • Validating the mutation against a current state using Validate(TState).
    • Applying the mutation via Apply(TState) to obtain a new state and results.
    • Optionally performing a dry-run simulation using Simulate(TState).

    Properties

    | Edit this page View Source

    Context

    Gets the execution context containing metadata about who, when, why, and how the mutation is executed.

    Declaration
    MutationContext Context { get; }
    Property Value
    Type Description
    MutationContext
    | Edit this page View Source

    Intent

    Gets the intent describing this mutation — what change is being performed and why.

    Declaration
    MutationIntent Intent { get; }
    Property Value
    Type Description
    MutationIntent

    Methods

    | Edit this page View Source

    Apply(TState)

    Applies the mutation to the given state and returns the result.

    Declaration
    MutationResult<TState> Apply(TState state)
    Parameters
    Type Name Description
    TState state

    The current state to mutate.

    Returns
    Type Description
    MutationResult<TState>

    A MutationResult<TState> containing the new state and any side-effects or logs.

    | Edit this page View Source

    Simulate(TState)

    Simulates the mutation without changing the actual state (dry-run). Useful for testing, previewing effects, or computing potential side-effects.

    Declaration
    MutationResult<TState> Simulate(TState state)
    Parameters
    Type Name Description
    TState state

    The current state to simulate the mutation on.

    Returns
    Type Description
    MutationResult<TState>

    A MutationResult<TState> reflecting the hypothetical outcome.

    | Edit this page View Source

    Validate(TState)

    Validates the mutation without applying it to ensure legality and preconditions.

    Declaration
    ValidationResult Validate(TState state)
    Parameters
    Type Name Description
    TState state

    The state against which validation should be performed.

    Returns
    Type Description
    ValidationResult

    A ValidationResult indicating whether the mutation is valid and any violations.

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