우리는 범위를 생성하고, 대화 상자 스택을로드하고, 중간에 인터럽트하고, 중단 된 스레드를 실행하는 Proactive 봇 샘플을 이해하려고합니다. 누군가가 Dependency Injection의 범위가 무엇인지 설명 할 수 있습니까? 나는 의존성 주입에 새로운 이며 C#의 Autofac입니다.Microsoft Bot Framework C#의 DialogModule.BeginLifeTimeScope은 무엇입니까?
1) DialogModule.BeginLifetimeScope(Conversation.Container
의 기능은 무엇입니까?
2) var stack = scope.Resolve<IDialogStack>();
의 기능은 무엇입니까?
3) await stack.PollAsync(CancellationToken.None);
의 기능은 무엇입니까?
4) await botData.FlushAsync(CancellationToken.None);
의 기능은 무엇입니까?
// Create a scope that can be used to work with state from bot framework.
using (var scope = DialogModule.BeginLifetimeScope(Conversation.Container, message))
{
var botData = scope.Resolve<IBotData>();
await botData.LoadAsync(CancellationToken.None);
// This is the dialog stack.
var stack = scope.Resolve<IDialogStack>();
// Create the new dialog and add it to the stack.
var dialog =new SurveyDialog();
stack.Call(dialog.Void<object, IMessageActivity>(), null);
await stack.PollAsync(CancellationToken.None);
// Flush the dialog stack back to its state store.
await botData.FlushAsync(CancellationToken.None);
}
[this] (https://autofac.readthedocs.io/en/latest/lifetime/index.html)을 읽으셨습니까? – Steven
나는 이것을 통과했지만 그것을 얻지 못했습니다. 내 4 가지 질문을 설명해 주시겠습니까 @Steven –
미안하지만 Bot 프레임 워크에 익숙하지 않습니다. – Steven