Skip to content

TransactionalState<TState> Methods

Provides a stateful facet which participates in Orleans transactions.

Participate(IGrainLifecycle)

View source
public void Participate(IGrainLifecycle lifecycle)
Adds the provided observer as a participant in the lifecycle.

Parameters

lifecycleIGrainLifecycle
The observer.

PerformRead(Func<TState, TResult>)

View source
public Task<TResult> PerformRead<TResult>(Func<TState, TResult> operation)
Performs a read operation and returns the result, without modifying the state.

Parameters

operationFunc<TState, TResult>
A function that reads the state and returns the result. The function must not modify the state.

Returns

A task whose result is the value returned by readFunction.

PerformUpdate(Func<TState, TResult>)

View source
public Task<TResult> PerformUpdate<TResult>(Func<TState, TResult> updateAction)
Performs an update operation and returns the result.

Parameters

updateActionFunc<TState, TResult>
A function that reads or updates the state and returns a result.

Returns

A task whose result is the value returned by updateFunction.