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

fix: update binding_to_syntax to use singleton scope according to docs #1309

Merged

Conversation

notaphplover
Copy link
Member

@notaphplover notaphplover commented Apr 14, 2021

Description

This PR adds singleton scope to those bindings which are singletons according to docs.

See https://github.com/inversify/InversifyJS/blob/master/wiki/scope.md#bindings-that-will-inject-an-object for more information

Related Issue

#1297

Motivation and Context

According to docs, the following bindings should be in singleton scope:

  • toConstructor.
  • toFactory.
  • toFunction.
  • toAutoFactory.
  • toProvider.

Actually, those bindings have the transient scope

How Has This Been Tested?

I've added a test for each type of binding to ensure onActivation is called once

Types of changes

  • Updated docs / Refactor code / Added a tests case (non-breaking change)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated the changelog.

@notaphplover notaphplover marked this pull request as ready for review April 15, 2021 20:22
Copy link
Member

@PodaruDragos PodaruDragos left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@dcavanagh dcavanagh left a comment

Choose a reason for hiding this comment

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

LGTM

@notaphplover notaphplover merged commit 784fec7 into master Apr 16, 2021
@notaphplover notaphplover deleted the fix/issue-1297-fix-on-activation-on-singleton-scope branch April 16, 2021 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants