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()
.As>()
.InstancePerDependency();
builder.RegisterType()
.Keyed>(FiberModule.Key_DoNotSerialize)
.AsImplementedInterfaces()
.SingleInstance();
builder.RegisterType()
.Keyed(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>());
}