DurableEntityContext interface
Provides functionality for application code implementing an entity operation.
Properties
entity |
Gets the id of the currently executing entity. |
entity |
Gets the key of the currently executing entity. |
entity |
Gets the name of the currently executing entity. |
is |
Whether this entity is freshly constructed, i.e. did not exist prior to this operation being called. |
operation |
Gets the name of the operation that was called. An operation invocation on an entity includes an operation name, which states what operation to perform, and optionally an operation input. |
Methods
destruct |
Deletes this entity after this operation completes. |
get |
Gets the input for this operation. An operation invocation on an entity includes an operation name, which states what operation to perform, and optionally an operation input. |
get |
Gets the current state of this entity, for reading and/or writing. |
return<TResult>(TResult) | Returns the given result to the caller of this operation. |
set |
Sets the current state of this entity. |
signal |
Signals an entity to perform an operation, without waiting for a response. Any result or exception is ignored (fire and forget). |
Property Details
entityId
entityKey
Gets the key of the currently executing entity.
entityKey: string
Property Value
string
entityName
Gets the name of the currently executing entity.
entityName: string
Property Value
string
isNewlyConstructed
Whether this entity is freshly constructed, i.e. did not exist prior to this operation being called.
isNewlyConstructed: boolean
Property Value
boolean
operationName
Gets the name of the operation that was called.
An operation invocation on an entity includes an operation name, which states what operation to perform, and optionally an operation input.
operationName: undefined | string
Property Value
undefined | string
Method Details
destructOnExit()
Deletes this entity after this operation completes.
function destructOnExit()
getInput<TInput>()
Gets the input for this operation.
An operation invocation on an entity includes an operation name, which states what operation to perform, and optionally an operation input.
function getInput<TInput>(): undefined | TInput
Returns
undefined | TInput
The operation input, or undefined if none.
getState(() => TState)
Gets the current state of this entity, for reading and/or writing.
function getState(initializer?: () => TState): undefined | TState
Parameters
- initializer
-
() => TState
Provides an initial value to use for the state, instead of TState's default.
Returns
undefined | TState
The current state of this entity, or undefined if none has been set yet.
return<TResult>(TResult)
Returns the given result to the caller of this operation.
function return<TResult>(result: TResult)
Parameters
- result
-
TResult
The result to return.
setState(TState)
Sets the current state of this entity.
function setState(state: TState)
Parameters
- state
-
TState
The state of the entity.
signalEntity(EntityId, string, unknown)
Signals an entity to perform an operation, without waiting for a response. Any result or exception is ignored (fire and forget).
function signalEntity(entity: EntityId, operationName: string, operationInput?: unknown)
Parameters
- entity
- EntityId
The target entity.
- operationName
-
string
The name of the operation.
- operationInput
-
unknown
The operation input.