examples, sandwichbot, use chain.from
return idialog<t>
sendasync
, this:
internal static idialog<sandwichorder> makerootdialog() { return chain.from(() => formdialog.fromform(sandwichorder.buildform)); }
i can see chain.from
pushes , pops iformdialog<t>
, returned formdialog.fromform
, not sure benefit of is. however, chatbot still works without chain.from
, shown below:
internal static idialog<sandwichorder> makerootdialog() { return formdialog.fromform(sandwichorder.buildform); }
since examples use chain.from
, makes me think might somehow required or recommended. rationale chain.from
, required, , drawbacks simpler syntax without it?
in simplesandwichbot believe doesn't make sense have chain.from
, suspect done allow seamless transition annotatedsandwichbot chain
being used bit more.
personally don't use chain
lot unless need put simple , don't want create dialog become complex read/follow.
with chain
can manage stack of dialogs implicitly. however, explicit management of stack of dialogs (using call/done) seems better composing larger conversations. creating new dialogs it's more verbose (especially in c#
) believe allows organize better solution , code.
i don't think there place chain
required it's not providing unique, fluent interface usable in linq
query syntax.
the drawbacks see around complexity of resulting code if trying create big. if don't misremember, there chance of getting serialization issue depending how using it.
from docs:
the chain methods provide fluent interface dialogs usable in linq query syntax. compiled form of linq query syntax leverages anonymous methods. if these anonymous methods not reference environment of local variables, these anonymous methods have no state , trivially serializable. however, if anonymous method captures local variable in environment, resulting closure object (generated compiler) not marked serializable. bot builder detect situation , throw closurecaptureexception diagnose issue.
Comments
Post a Comment