Where is IHttpControllerFactory?

佐手、 提交于 2020-01-03 13:41:16

问题


Microsoft website says there is a IHttpControllerFactory which can be used to generate controllers in custom ways.

However, the System.Web.Http DLL referenced from Visual Studio: packages\Microsoft.AspNet.WebApi.Core.4.0.20710.0\lib\net40\System.Web.Http.dll

Doesn't have that interface:

So where is the interface now?


回答1:


It's gone and replaced by a dependency resolver or more specifically the IDependencyResolver interface. Once you write your own dependency resolve you could plug it into the Web API:

config.DependencyResolver = new MyDependencyResolver();



回答2:


Cannot find it as well.

Anyway you can use IHttpControllerActivator to create your custom controller factories in Web API.



来源:https://stackoverflow.com/questions/19640674/where-is-ihttpcontrollerfactory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!