Class SaveSagaRequest<TSagaState>
Represents a data request to save a saga state to the SQL Server saga store.
public sealed class SaveSagaRequest<TSagaState> : DataRequestBase<IDbConnection, int>, IDataRequest<IDbConnection, int>, IDataRequest where TSagaState : SagaState
Type Parameters
TSagaStateThe type of the saga state.
- Inheritance
-
SaveSagaRequest<TSagaState>
- Implements
- Inherited Members
Constructors
SaveSagaRequest(TSagaState, DispatchJsonSerializer, string, TenantScope, CancellationToken)
Initializes a new instance of the SaveSagaRequest<TSagaState> class.
[RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed.")]
[RequiresDynamicCode("JSON serialization and deserialization might require runtime code generation.")]
public SaveSagaRequest(TSagaState sagaState, DispatchJsonSerializer serializer, string qualifiedTableName, TenantScope scope, CancellationToken cancellationToken)
Parameters
sagaStateTSagaStateThe saga state to save.
serializerDispatchJsonSerializerThe JSON serializer for serializing saga state.
qualifiedTableNamestringThe fully qualified saga table name.
scopeTenantScopeThe tenant scope. When tenant-scoped it is the isolation authority: the saga row is stamped with this tenant and the version-gated MERGE match additionally requires the persisted tenant to equal it, so a save under one tenant can never match (and overwrite) another tenant's saga. When the scope is untenanted it stamps the reserved sentinel, not an absent tenant, so the term is present either way and the match predicate is unconditional. A tenant-scoped scope cannot be constructed without a tenant, so a predicate-less save while tenancy is active is unrepresentable.
cancellationTokenCancellationTokenThe cancellation token.
Exceptions
- ArgumentOutOfRangeException
The saga state's version is negative.
- OverflowException
The saga state's version is MaxValue and cannot be incremented.