Skip to content

Grain Methods

The abstract base class for all grain classes.

OnActivateAsync(CancellationToken)

virtual
View source
public virtual Task OnActivateAsync(CancellationToken cancellationToken)
This method is called at the end of the process of activating a grain. It is called before any messages have been dispatched to the grain. For grains with declared persistent state, this method is called after the State property has been populated.

Parameters

cancellationTokenCancellationToken
A cancellation token which signals when activation is being canceled.

OnDeactivateAsync(DeactivationReason, CancellationToken)

virtual
View source
public virtual Task OnDeactivateAsync(DeactivationReason reason, CancellationToken cancellationToken)
This method is called at the beginning of the process of deactivating a grain.

Parameters

reasonDeactivationReason
The reason for deactivation. Informational only.
cancellationTokenCancellationToken
A cancellation token which signals when deactivation should complete promptly.