webapi中的扩展点
Extension Points
Web API provides extension points for some parts of the routing process.
Interface | Description |
---|---|
IHttpControllerSelector | Selects the controller. |
IHttpControllerTypeResolver | Gets the list of controller types. The DefaultHttpControllerSelector chooses the controller type from this list. |
IAssembliesResolver | Gets the list of project assemblies. The IHttpControllerTypeResolver interface uses this list to find the controller types. |
IHttpControllerActivator | Creates new controller instances. |
IHttpActionSelector | Selects the action. |
IHttpActionInvoker | Invokes the action. |
To provide your own implementation for any of these interfaces, use the Services collection on the HttpConfiguration object:
var config = GlobalConfiguration.Configuration;
config.Services.Replace(typeof(IHttpControllerSelector), new MyControllerSelector(config));