-
Notifications
You must be signed in to change notification settings - Fork 25
Set ChildKernel's service scope to singleton by default #11
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is out of the scope of setting the scope as Singleton by default? =)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was remaking why do you nee to unseal it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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;
}
}
??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you got 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.