You don't need to write you own IHttpControllerActivator
because you can register the RouteLinker
itself in the container.
You just need the help of the RegisterHttpRequestMessage
method which makes the HttpRequestMessage
resolvable from the container.
So your RouteLinker
registration will look something like this:
builder.RegisterHttpRequestMessage(GlobalConfiguration.Configuration);
builder.Register(c => new RouteLinker(c.Resolve<HttpRequestMessage>()))
.InstancePerApiRequest();
Now you can depend on the RouteLinker
in your controllers:
public MyController : ApiController
{
public MyController(RouteLinker routeLinker)
{
//do stuff with routeLinker
}
}