Set ChildKernel's service scope to singleton by default#11
Set ChildKernel's service scope to singleton by default#11thecodejunkie merged 2 commits intoNancyFx:masterfrom
Conversation
There was a problem hiding this comment.
This is out of the scope of setting the scope as Singleton by default? =)
There was a problem hiding this comment.
As far as I know, in most cases, it is Singleton in request scope. Since CreateRequestContainer is marked as sealed, I can't set the kernel's default scope. That's why I sent this pull request.
There was a problem hiding this comment.
I was remaking why do you nee to unseal it?
There was a problem hiding this comment.
Sorry I don't understand your question. Are you asking why I unseal the method? Just as I said, otherwise I can't set NinjectSettings for the ChildKernel.
For example, I want to set AllowNullInjection to true.
The NinjectSettings can only pass by kernel's constructor.
There was a problem hiding this comment.
Ok so you unsealed it, so you can override it in your own boostrapper like
public class MyBootstrapper : NinjectNancyBootstrapper
{
public override IKernel CreateRequestContainer()
{
// create your IKernel instance and return it;
}
}
??
|
Any objections please? |
|
Hoping to review this and some other pending pull-requests later tonight |
Set ChildKernel's service scope to singleton by default
|
Much appreciated @scott-xu welcome to the Nancy contributor club! :) |
|
Thank you. BTW, I think we can delete FactoryModule as well because Ninject has a official factory extension |
|
I think I can send a new pull request later |
|
@scott-xu happy to take a PR and look at it =) The less code we have to maintain the better :) |
|
@thecodejunkie PR has had been sent #12 |
No description provided.