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)
posted @ 2016-07-15 16:33  irocker  阅读(1092)  评论(0编辑  收藏  举报