Table of Contents

Class MutationState<TData>

Namespace
DotNetQuery.Core
Assembly
DotNetQuery.Core.dll

An immutable snapshot of a mutation's current state. Use the static factory methods to create instances.

public sealed record MutationState<TData> : IEquatable<MutationState<TData>>

Type Parameters

TData

The type of data returned by the mutation on success.

Inheritance
MutationState<TData>
Implements
Inherited Members

Properties

CurrentData

The data returned by the most recent successful execution. null when the mutation has not yet succeeded.

public TData? CurrentData { get; }

Property Value

TData

Error

The exception from the most recent failed execution. null when not in a failure state.

public Exception? Error { get; }

Property Value

Exception

HasData

true when the mutation has succeeded and CurrentData is available.

public bool HasData { get; }

Property Value

bool

HasError

true when Error is not null.

public bool HasError { get; }

Property Value

bool

IsFailure

true when Status is Failure.

public bool IsFailure { get; }

Property Value

bool

IsIdle

true when Status is Idle.

public bool IsIdle { get; }

Property Value

bool

IsRunning

true when Status is Running.

public bool IsRunning { get; }

Property Value

bool

IsSuccess

true when Status is Success.

public bool IsSuccess { get; }

Property Value

bool

Status

The current lifecycle status of the mutation.

public MutationStatus Status { get; }

Property Value

MutationStatus

Methods

CreateFailure(Exception)

Creates a Failure state with the given error.

public static MutationState<TData> CreateFailure(Exception error)

Parameters

error Exception

The exception thrown by the mutation.

Returns

MutationState<TData>

CreateIdle()

Creates an Idle state.

public static MutationState<TData> CreateIdle()

Returns

MutationState<TData>

CreateRunning()

Creates a Running state.

public static MutationState<TData> CreateRunning()

Returns

MutationState<TData>

CreateSuccess(TData)

Creates a Success state with the returned data.

public static MutationState<TData> CreateSuccess(TData data)

Parameters

data TData

The data returned by the mutation.

Returns

MutationState<TData>