I\'ve been trying to pass a service to a LuisDialog from the MessagesController like so:
public async Task Post([FromBody]Activity act
In the Global.asax.cs, you can do do the following to register your services/dialogs:
ContainerBuilder builder = new ContainerBuilder();
builder.RegisterType<IntroDialog>()
.As<IDialog<object>>()
.InstancePerDependency();
builder.RegisterType<JobsMapper>()
.Keyed<IMapper<DocumentSearchResult, GenericSearchResult>>(FiberModule.Key_DoNotSerialize)
.AsImplementedInterfaces()
.SingleInstance();
builder.RegisterType<AzureSearchClient>()
.Keyed<ISearchClient>(FiberModule.Key_DoNotSerialize)
.AsImplementedInterfaces()
.SingleInstance();
builder.Update(Conversation.Container);
In your controller, you can then resolve your main dialog as:
using (var scope = DialogModule.BeginLifetimeScope(Conversation.Container, activity))
{
await Conversation.SendAsync(activity, () => scope.Resolve<IDialog<object>>());
}