Skip to content
This repository was archived by the owner on Apr 26, 2020. It is now read-only.

Conversation

@scott-xu
Copy link
Contributor

No description provided.

Copy link
Member

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? =)

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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;
    }
}

??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you got it

@scott-xu
Copy link
Contributor Author

Any objections please?

@thecodejunkie
Copy link
Member

Hoping to review this and some other pending pull-requests later tonight

thecodejunkie added a commit that referenced this pull request Jan 21, 2014
Set ChildKernel's service scope to singleton by default
@thecodejunkie thecodejunkie merged commit 1374f21 into NancyFx:master Jan 21, 2014
@thecodejunkie
Copy link
Member

Much appreciated @scott-xu welcome to the Nancy contributor club! :)

@scott-xu
Copy link
Contributor Author

Thank you. BTW, I think we can delete FactoryModule as well because Ninject has a official factory extension
https://github.com/ninject/ninject.extensions.factory

@scott-xu
Copy link
Contributor Author

I think I can send a new pull request later

@thecodejunkie
Copy link
Member

@scott-xu happy to take a PR and look at it =) The less code we have to maintain the better :)

@scott-xu
Copy link
Contributor Author

@thecodejunkie PR has had been sent #12

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants