BotStatePropertyAccessor class

A BotState specific implementation of the StatePropertyAccessor interface.

Remarks

Properties can be defined for a given BotState instance using createProperty().

const dialogStateProperty = ConversationState.createProperty('dialogState');
const dialogs = new DialogSet(dialogStateProperty);

Constructors

BotStatePropertyAccessor(BotState, string)

Creates a new BotStatePropertyAccessor instance.

Properties

name

Methods

delete(TurnContext)

Deletes the persisted property from its backing storage object.

get(TurnContext)

Reads a persisted property from its backing storage object.

get(TurnContext, T)
set(TurnContext, T)

Assigns a new value to the properties backing storage object.

Constructor Details

BotStatePropertyAccessor(BotState, string)

Creates a new BotStatePropertyAccessor instance.

new BotStatePropertyAccessor(state: BotState, name: string)

Parameters

state
BotState

Parent BotState instance.

name

string

Unique name of the property for the parent BotState.

Property Details

name

name: string

Property Value

string

Method Details

delete(TurnContext)

Deletes the persisted property from its backing storage object.

function delete(context: TurnContext): Promise<void>

Parameters

context
TurnContext

(xref:botbuilder-core.TurnContext) object for this turn.

Returns

Promise<void>

get(TurnContext)

Reads a persisted property from its backing storage object.

function get(context: TurnContext): Promise<T | undefined>

Parameters

context
TurnContext

(xref:botbuilder-core.TurnContext) object for this turn.

Returns

Promise<T | undefined>

A JSON representation of the cached state.

get(TurnContext, T)

function get(context: TurnContext, defaultValue: T): Promise<T>

Parameters

context
TurnContext
defaultValue

T

Returns

Promise<T>

set(TurnContext, T)

Assigns a new value to the properties backing storage object.

function set(context: TurnContext, value: T): Promise<void>

Parameters

context
TurnContext

(xref:botbuilder-core.TurnContext) object for this turn.

value

T

Value to set on the property.

Returns

Promise<void>