ASP.NET Core DependencyResolver

后端 未结 7 721
故里飘歌
故里飘歌 2020-12-15 19:20

In ASP.NET MVC 5 is possible to obtain some dependency through DependencyResolver.Current.GetService(). Is there something similar in ASP.NET Core?

相关标签:
7条回答
  • 2020-12-15 19:56

    I also want to add to the main answer, In razor view pages we can use @inject directive for DI. It will retrieve the targeted services to view pages on Asp.Net core, like this

    @inject XYZ.Web.Services.CurrencyService currencyService;
    
    0 讨论(0)
提交回复
热议问题