dotnet / dotnet/docs

More examples of Singleton, Transient and Scoped Injection Dependency

Open
#41,082 4 comments 0 reactions 0 assignees View on GitHub
:watch: Not Triaged dotnet-fundamentals/svc
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
15h 21m
Merged PRs (30d)
370

Description

### Type of issue

Thank you

### Description

I need to use two types of constructors: one for the application and another for the tester. So, I need to master the subject of dependency injection to avoid the aggregation error, which indicates circular references. I tried to implement the example given, but it didn't work. And there's just one example... What changes should be made to the classes to be able to do dependency injection? What should be added? what should be removed? Help me, because I'm using Moq and I can't remove the constructor with injection! I could give two examples: normal mode and using transient, scoped and singleton and teach how the student can migrate the modes to make it work. Thanks

### Page URL

https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection

### Content source URL

https://github.com/dotnet/docs/blob/main/docs/core/extensions/dependency-injection.md

### Document Version Independent Id

cc5f00d0-fb50-1229-8fa2-e66b1f45b284

### Article author

@IEvangelist

### Metadata

* ID: 8fd55089-b683-2202-6641-c7b61a132f14
* Service: **dotnet-fundamentals**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.