How to use Func in built-in dependency injection

前端 未结 6 696
梦毁少年i
梦毁少年i 2021-02-14 11:17

Using asp.net 5 I\'d like my controller to be injected with a Funcinstead of T

For example:



        
6条回答
  •  遇见更好的自我
    2021-02-14 11:49

    As far as I'm aware deferring dependencies like this isn't possible using the current default IoC container within ASP.NET Core. I've not been able to get it working anyway!

    To defer the initialisation of dependencies like this you'll need to implement an existing, more feature rich IoC container.

提交回复
热议问题