Inject DialogContext to BoolExpression
See original GitHub issueIs your feature request related to a problem? Please describe. On adaptive dialogs, I am trying to implement custom validation (eg. Calling external API with user input as parameter), custom retry message based on the response of API and store validation result on conversation state.
Describe the solution you’d like
I would like BoolExpression to have a method that accepts Func<object, DialogContext, object>
, an addition of DialogContext to existing method here
This way, I would be able to access ConversationState
via dc.Context.TurnState.Get<ConversationState>()
(not injecting ConversationState to dialog) and save validation result on ConversationState
by creating property state accessors and calling SetAsync
method
Describe alternatives you’ve considered
- Storing ConversationState to dialog class: Still does not have access to DialogContext and TurnContext.
Haven’t tested storing DialogContext, as I thought changes on DialogContext between it is stored and custom validation not reflected on DialogContext.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Top GitHub Comments
You can’t do this declaratively with our current classes, but you can do this easily with custom classes.
For example, if you create a new class which derives from NumberInput and overrides OnRecognizeInputAsync() then you have access exactly to what you need to do your validatation, the dc and async<task>.
Something like this:
Register it as a custom component and now you have rich partnumber input with async validation.
@tomlm Could you comment on this?