Skip to content

Support for request scope on fluentProvider #207

@gustavolanna

Description

@gustavolanna

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions