ASP.NET Core Singleton instance vs Transient instance performance

前端 未结 2 759
野性不改
野性不改 2021-02-12 14:42

In ASP.NET Core Dependency Injection, I just wonder if registering Singleton instances will improve performance better than registering Transient insta

2条回答
  •  抹茶落季
    2021-02-12 15:23

    Like mentioned in the replies this isn't really a matter over performance.

    For more details please see the link below where the difference is very elaborately explained. https://stackoverflow.com/a/38139500/10551193

    The only way that this will matter performance wise is if your constructor is doing a lot of stuff. This can and should be avoided though in all cases.

提交回复
热议问题