Accessing the Ninject Kernel Globally

后端 未结 4 496
名媛妹妹
名媛妹妹 2021-02-05 09:25

This question is not specifically related to Ninject. It\'s more of a general coding question, but I\'m posting it here in case there might be a better way entirely of handling

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-05 10:04

    The most simple way (IMO):

    _className = (IClassName)System.Web.Mvc.DependencyResolver.Current.GetService(typeof(IClassName));
    

提交回复
热议问题