none
How to access value stored in TurnContext inside a Dialog. RRS feed

  • Question


  • I am setting value here,

    var userProfile = _userProfileAccessor.GetAsync(stepContext.Context, () => new UserProfile(), cancellationToken).Result;
                userProfile.UserName= "test";
                await _userProfileAccessor.SetAsync(stepContext.Context, userProfile).ConfigureAwait(false);

    I am trying to get my value here,

    var userProfile = _userProfileAccessor.GetAsync(stepContext.Context, () => new UserProfile(), cancellationToken).Result;

    This works when i try to get within the dialog, but when i move another dialog i could see empty userProfile.



    Monday, September 2, 2019 11:54 AM

All replies

  • Hello,

    • What is turnContext?
    • What is a dialog?
    • What type of project?

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Monday, September 2, 2019 12:02 PM
  • Hi 

    Thank you for posting here.

    Based on my search, I only find the following MSDN doc may be related to your question. However, I still could not find turnContext.Value property. 

    TurnContext Class

    Therefore, I hope that you could provide a simple and completed code with us so that we could solve your problem better.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, September 3, 2019 1:47 AM
  • This is regarding Microsoft Bot Framework 4, I am trying to do state management.
    Tuesday, September 3, 2019 7:11 AM
  • Hi 

    Thanks for the feedback.

    Since this thread is related to Bot Framework, I suggest that you could post it in the stack overflow.

    The Visual C# forum discusses and asks questions about the C# programming language, IDE, libraries, samples, and tools.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, September 3, 2019 7:16 AM
  • I am not allowed to post questions on Stack Over flow. So i reach out here.
    Wednesday, September 4, 2019 11:04 AM