Where is IHttpControllerFactory?

2019-06-26 04:52发布

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:

enter image description here

So where is the interface now?

2条回答
家丑人穷心不美
2楼-- · 2019-06-26 05:30

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();
查看更多
我命由我不由天
3楼-- · 2019-06-26 05:43

Cannot find it as well.

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

查看更多
登录 后发表回答