My nancy Bootstrapper is like this:
public class Bootstrapper : NinjectNancyBootstrapper
{
protected override void ApplicationStartup(IKernel container, IPipelines pipelines)
{
Csrf.Enable(pipelines);
}
protected override void ConfigureRequestContainer(IKernel container, NancyContext context)
{
// Perform registrations that should have a request lifetime
container.Bind<IRepository<User>>().To<Repository<User>>().InSingletonScope();
}
}
I got a Nancy Module:
public class UsersModule : NancyModule
{
private IRepository<User> users;
public UsersModule(IRepository<User> usersRepo)
{
this.users = usersRepo;
}
}
When I start my app, I get an error:
Error activating ISession
No matching bindings are available, and the type is not self-bindable. Activation path:
3) Injection of dependency ISession into parameter session of constructor of type Repository{User}
2) Injection of dependency IRepository{User} into parameter usersRepo of constructor of type UsersModule
1) Request for INancyModule
Suggestions:
1) Ensure that you have defined a binding for ISession.
2) If the binding was defined in a module, ensure that the module has been loaded into the kernel.
3) Ensure you have not accidentally created more than one kernel.
4) If you are using constructor arguments, ensure that the parameter name matches the constructors parameter name.
5) If you are using automatic module loading, ensure the search path and filters are correct.
Any clue? I'm lost...
问题是我没有注入NHibernate的ISession ... X-(
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.