Skip to content
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

Support for request scope on fluentProvider #1434

Open
gustavolanna opened this issue Feb 4, 2022 · 1 comment
Open

Support for request scope on fluentProvider #1434

gustavolanna opened this issue Feb 4, 2022 · 1 comment

Comments

@gustavolanna
Copy link

Summary:

I'm currently using request scopes on my project and I'd like to start using the decorators, but it seems there is no support for request scope in the library.

Expected Behavior

I'd like to use the request scope on the decorated classes.

Current Behavior

The class ProvideInSyntax just has methods for singleton and transient scope, but no support for request scope.

Possible Solution

Add a new method to this class to support in request scope

    public inRequestScope(): interfaces.ProvideWhenOnSyntax<T> {
        let bindingWhenOnSyntax = (bind: inversifyInterfaces.Bind, target: any) => this._bindingInSyntax(bind, target).inRequestScope();
        let inDoneSyntax = new ProvideDoneSyntax(bindingWhenOnSyntax);

        let provideWhenSyntax = new ProvideWhenSyntax<T>(bindingWhenOnSyntax, inDoneSyntax);
        let provideOnSyntax = new ProvideOnSyntax<T>(bindingWhenOnSyntax, inDoneSyntax);
        return new ProvideWhenOnSyntax(provideWhenSyntax, provideOnSyntax);
    }

@tlyau62
Copy link

tlyau62 commented Mar 22, 2022

Is there any workaround for this issue?

Seems like there exists a PR already.

Anything we can help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants