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

Injecting a transient or scoped service won't work #317

Open
Elie-A-98 opened this issue Jul 8, 2024 · 0 comments
Open

Injecting a transient or scoped service won't work #317

Elie-A-98 opened this issue Jul 8, 2024 · 0 comments

Comments

@Elie-A-98
Copy link

Elie-A-98 commented Jul 8, 2024

All the controllers are injected as singletons. So if we have a transient or scoped service to be injected in a controller, it won't work because it has a shorter lifetime.

For ex resolving a scoped service in a controller will always return the same instance of that service because the containing class is a singleton.

Am I missing something or is that assumption right ?

@Elie-A-98 Elie-A-98 changed the title will injecting a transient or scope service in any controller work ? Injecting a transient or scope service won't work Jul 8, 2024
@Elie-A-98 Elie-A-98 changed the title Injecting a transient or scope service won't work Injecting a transient or scoped service won't work Jul 8, 2024
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

No branches or pull requests

1 participant