Does ASP.NET Core's DI container assures order of services?

后端 未结 2 513
名媛妹妹
名媛妹妹 2021-01-16 13:05

When I register multiple services to the DI container with the same interface and then request an IEnumerable, do the container guarantee that t

相关标签:
2条回答
  • 2021-01-16 13:39

    Yes they execute in order, read more: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-3.1

    EDIT: More specific link: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/startup?view=aspnetcore-3.1#extend-startup-with-startup-filters

    Thanks to @Sai Puli

    0 讨论(0)
  • 2021-01-16 13:42

    Yes it does. The order is based on registration order and is guaranteed

    0 讨论(0)
提交回复
热议问题