Can you explain instance management in.net core?
Loading
Can you explain instance management in.net core?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Brahma Prakash ShuklaPosted Nov 9, 2022, 9:50 AM
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/app-state?view=aspnetcore-7.0
Vishal YelvePosted Nov 9, 2022, 8:43 AM
Transient objects are always different; a new instance is provided to every controller and every service.
Scoped objects are the same within a request, but different across different requests.
Singleton objects are the same for every object and every request.
Vishal JoshiPosted Nov 9, 2022, 7:23 AM
Hello,
It's just a change of words and makes the question tricky and interesting. Also, it can be asked like what are dependency injections? or what are the extension methods?
The built-in IoC container supports three kinds of lifetimes:
Singleton: IoC container will create and share a single instance of a service throughout the application's lifetime.
Transient: The IoC container will create a new instance of the specified service type every time you ask for it.
Scoped: IoC container will create an instance of the specified service type once per request and will be shared in a single request.
Thanks