I would like to enter different lines in each of my module constructors. I am registering a factory method that creates a module. Then I can call container.Resolve<T>()and everything will be fine. For some reason, although Nancy is trying to resolve my module, she throws an error
Nancy.TinyIoc.TinyIoCResolutionException: Unable to resolve type: Plugin.HomeModule ---> Nancy.TinyIoc.TinyIoCResolutionException: Unable to resolve type: System.String
public class HomeModule : NancyModule
{
public HomeModule(string text)
{
}
}
protected override void ConfigureApplicationContainer(TinyIoCContainer container)
{
base.ConfigureApplicationContainer(container);
container.Register<HomeModule>((ctr, param) => { return new HomeModule("text"); });
HomeModule module = container.Resolve<HomeModule>();
}
I also tried registering ConfigureRequestContainer()with the same results. I tried container.Register<HomeModule>(new HomeModule("some text"));as well AsSingleton(). I can register the implementation for the string type with container.Register<string>("text"), but this will lead to the introduction of the same string in all modules.
, Nancy ?