Class MutationOptions<TArgs, TData>
- Namespace
- DotNetQuery.Core
- Assembly
- DotNetQuery.Core.dll
Configuration options for a single mutation created via CreateMutation<TArgs, TData>(MutationOptions<TArgs, TData>).
public sealed record MutationOptions<TArgs, TData> : IEquatable<MutationOptions<TArgs, TData>>
Type Parameters
TArgsThe type of the arguments passed to the mutator.
TDataThe type of the data returned on success.
- Inheritance
-
MutationOptions<TArgs, TData>
- Implements
-
IEquatable<MutationOptions<TArgs, TData>>
- Inherited Members
Properties
InvalidateKeys
A list of QueryKey values to invalidate automatically after a successful execution.
null skips automatic invalidation.
public IReadOnlyList<QueryKey>? InvalidateKeys { get; init; }
Property Value
IsEnabled
Whether the mutation is initially enabled. Defaults to true.
When false, calls to Execute(TArgs) are silently ignored.
public bool IsEnabled { get; init; }
Property Value
Mutator
The async function that performs the mutation for the given args. Receives a CancellationToken that is cancelled when the mutation is cancelled or disposed.
public required Func<TArgs, CancellationToken, Task<TData>> Mutator { get; init; }
Property Value
- Func<TArgs, CancellationToken, Task<TData>>
OnFailure
Invoked after each failed execution with the thrown exception. Called before OnSettled.
public Action<Exception>? OnFailure { get; init; }
Property Value
OnSettled
Invoked after every execution that reaches a terminal state: success, failure, or cancellation. Called after OnSuccess or OnFailure when applicable.
public Action? OnSettled { get; init; }
Property Value
OnSuccess
Invoked after each successful execution with the original args and the returned data. Called before OnSettled.
public Action<TArgs, TData>? OnSuccess { get; init; }
Property Value
- Action<TArgs, TData>
RetryHandler
Overrides the global RetryHandler. null uses the global default.
public IRetryHandler? RetryHandler { get; init; }