If you are going to use dependency injection framework in Net Core you must control the service lifetime concept.
The service lifetime controls how long a result object will live for after it has been created by the container
Only one service instance is created and shared across all requests.
We need to be aware of concurrency and threading issues
One service instance is created for each request and reused throughout the request.
Request is considered as scope
A new service instance is created every time even if it’s the same request
It’s most common and always the safest option if you are worried about multithreading
Leave a Reply