Table of Contents

Interface IStatePropertyAccessor<T>

Namespace
Microsoft.Agents.Builder.State
Assembly
Microsoft.Agents.Builder.dll

Interface which defines methods for how you can get data from a property source, such as AgentState.

public interface IStatePropertyAccessor<T>

Type Parameters

T

type of the property.

Properties

Name

Gets the name of the property.

string Name { get; }

Property Value

string

The name of the property.

Methods

DeleteAsync(ITurnContext, CancellationToken)

Delete the property from the source.

Task DeleteAsync(ITurnContext turnContext, CancellationToken cancellationToken = default)

Parameters

turnContext ITurnContext

Turn Context.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A Task representing the asynchronous operation.

GetAsync(ITurnContext, Func<T>, CancellationToken)

Gets the property value from the source.

Task<T> GetAsync(ITurnContext turnContext, Func<T> defaultValueFactory = null, CancellationToken cancellationToken = default)

Parameters

turnContext ITurnContext

Turn Context.

defaultValueFactory Func<T>

Function which defines the property value to be returned if no value has been set.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<T>

A Task representing the result of the asynchronous operation.

SetAsync(ITurnContext, T, CancellationToken)

Set the property value on the source.

Task SetAsync(ITurnContext turnContext, T value, CancellationToken cancellationToken = default)

Parameters

turnContext ITurnContext

Turn Context.

value T

The value to set.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A Task representing the asynchronous operation.