DI中Transient Scoped Singleton Instance的区别

Observe which of the OperationId values varies within a request, and between requests.

  • 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 (regardless of whether an instance is provided in ConfigureServices)
原文地址:https://www.cnblogs.com/irocker/p/5674071.html