I don't think that will work since the LuisModel
is being injected to the LuisService
you are registering (which probably is the next line in your configuration) and the LuisService is just expecting a single model and not an array of them.
The way I can think this could work is, instead of registering the model(s) to the Autofac
container, you should register multiple LuisService
defining the value of the model parameter of the constructor to each of your models (see this).
In that way, when you resolve your LuisDialog
based dialog, it will inject multiple ILuisService
(see this) as it's prepared to receive an array of services.
I haven't tried this, but you could see if something like this works:
var model1 = new LuisModelAttribute("model1", "");
var model2 = new LuisModelAttribute("model2", "");
builder.RegisterType<LuisService>()
.WithParameter("model", model1)
.Keyed<ILuisService>(FiberModule.Key_DoNotSerialize)
.AsImplementedInterfaces()
.SingleInstance(); or // .InstancePerLifetimeScope()
builder.RegisterType<LuisService>()
.WithParameter("model", model2)
.Keyed<ILuisService>(FiberModule.Key_DoNotSerialize)
.AsImplementedInterfaces()
.SingleInstance(); or // .InstancePerLifetimeScope()
Alternatively, you can use RegisterInstance
and register the instances of the LuisService
with their specific model.