New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "transaction" scope support #13

Closed
remojansen opened this Issue Apr 20, 2015 · 1 comment

Comments

Projects
None yet
1 participant
@remojansen
Member

remojansen commented Apr 20, 2015

When adding a binding allow "transaction" as scope.

Users can then create a "transaction" with:

kernel.beginTransaction("inteface");

And finish it with:

kernel.endTransaction("inteface");

Between beginTransaction and endTransaction if resolve is invoked:

kernel.resolve<inteface>("inteface");

The IoC container will use singleton scope.

If resolve is invoked before beginTransaction has been invoked the IoC container will use transient scope.

This is useful when we want a module to be a singleton within a scope. If we are in a scope (e.g.controller) and we navigate to a different scope (e.g. another controller) we might want our module to stop using singleton scope or create a new singleton within the new scope. All we need to do is to invoke beginTransaction when creating a scope (e.g. navigating to a controller) and endTransaction when leaving the scope (e.g. disposing the controller).

@remojansen remojansen added this to the 1.0 milestone Apr 20, 2015

@remojansen

This comment has been minimized.

Show comment
Hide comment
@remojansen

remojansen May 10, 2015

Member

I decided that this feature will not be implemented I will implement a much more powerful feature "contextual binding" #15

Member

remojansen commented May 10, 2015

I decided that this feature will not be implemented I will implement a much more powerful feature "contextual binding" #15

@remojansen remojansen closed this May 10, 2015

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