Skip to content

Commit 564486f

Browse files
authored
Merge branch 'live' into live-sync-work
2 parents aef7d80 + e233374 commit 564486f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Thank you for your interest in Bot Framework documentation!
1313

1414
* [Ways to contribute](#ways-to-contribute)
1515
* [Code of conduct](#code-of-conduct)
16-
* [About your contributions to Bot Framework content](#about-your-contributions-to-Bot-Framework-content)
16+
* [About your contributions to Bot Framework content](#about-your-contributions-to-bot-framework-content)
1717
* [Repository organization](#repository-organization)
1818
* [Use GitHub, Git, and this repository](#use-github-git-and-this-repository)
1919
* [How to use markdown to format your topic](#how-to-use-markdown-to-format-your-topic)

articles/v4sdk/bot-builder-howto-v4-state.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class UserProfile
5353
The `TopicState` class has a flag to keep track of where we are in the conversation and uses conversation state to store it. The Prompt is initialized as "askName" to initiate the conversation. Once the bot receives response from the user, Prompt will be redefined as "askNumber" to initiate the next conversation. `UserProfile` class tracks user name and phone number and stores it in user state.
5454

5555
### Property accessors
56-
The `EchoBotAccessors` class in our example is created as a singleton and passed into the `class EchoWithCounterBot : IBot` constructor through dependency injection. The `EchoBotAccessors` class constructor initializes a new instance of the `EchoBotAccessors` class. It contains the `ConversationState`, `UserState`, and associated `IStatePropertyAccessor`. The `conversationState` object stores the topic state and `userState` object that stores the user profile information. The `ConversationState` and `UserState` objects are created in the Startup.cs file. The conversation and user state objects are where we persist anything at the conversation and user scope.
56+
The `EchoBotAccessors` class in our example is created as a singleton and passed into the `class EchoWithCounterBot : IBot` constructor through dependency injection. The `EchoBotAccessors` class contains the `ConversationState`, `UserState`, and associated `IStatePropertyAccessor`. The `conversationState` object stores the topic state and `userState` object that stores the user profile information. The `ConversationState` and `UserState` objects will be created later in the Startup.cs file. The conversation and user state objects are where we persist anything at the conversation and user scope.
5757

5858
Updated the constructor to include `UserState` as shown below:
5959
```csharp
@@ -97,7 +97,7 @@ services.AddBot<EchoWithCounterBot>(options =>
9797
options.State.Add(userState);
9898
});
9999
```
100-
The line `options.State.Add(ConversationState);` and `options.State.Add(userState);` add the conversation state and user state, respectively. Next, create and register state accesssors. Acessors created here are passed into the IBot-derived class on every turn. Modift the code to inclue user state as shown below:
100+
The line `options.State.Add(ConversationState);` and `options.State.Add(userState);` add the conversation state and user state, respectively. Next, create and register state accesssors. Accessors created here are passed into the IBot-derived class on every turn. Modify the code to inclue user state as shown below:
101101
```csharp
102102
services.AddSingleton<EchoBotAccessors>(sp =>
103103
{
@@ -116,17 +116,17 @@ Next, create the two accessors using `TopicState` and `UserProfile` and pass it
116116
services.AddSingleton<EchoBotAccessors>(sp =>
117117
{
118118
...
119-
var accessors = new BotAccessors(conversationState, userState)
119+
var accessors = new EchoBotAccessors(conversationState, userState)
120120
{
121-
TopicState = conversationState.CreateProperty<TopicState>("TopicState"),
122-
UserProfile = userState.CreateProperty<UserProfile>("UserProfile"),
121+
TopicState = conversationState.CreateProperty<TopicState>(EchoBotAccessors.TopicStateName),
122+
UserProfile = userState.CreateProperty<UserProfile>(EchoBotAccessors.UserProfileName),
123123
};
124124

125125
return accessors;
126126
});
127127
```
128128

129-
The conversation and user state are linked to a singleton via the `services.AddSingleton` code block and saved via a state store accessor in the code starting with `var accessors = new BotAccessor(conversationState, userState)`.
129+
The conversation and user state are linked to a singleton via the `services.AddSingleton` code block and saved via a state store accessor in the code starting with `var accessors = new EchoBotAccessor(conversationState, userState)`.
130130

131131
### Use conversation and user state properties
132132
In the `OnTurnAsync` handler of the `EchoWithCounterBot : IBot` class, modify the code to prompt for user name and then phone number. To track where we are in the conversation, we use the Prompt property defined in the TopicState. This property was initialized a "askName". Once we get the user name, we set it to "askNumber" and set the UserName to the name user typed in. After the phone number is received, you send a confirmation message and set the prompt to 'confirmation' because you are at the end of the conversation.

0 commit comments

Comments
 (0)