docs icon indicating copy to clipboard operation
docs copied to clipboard

More examples of Singleton, Transient and Scoped Injection Dependency

Open zabpetrus opened this issue 9 months ago • 4 comments

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

zabpetrus avatar May 26 '24 20:05 zabpetrus