I'm using DryIOC.WebAPI to resolve my APIControllers.
WebAPI Config is thus:
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
// Configure Web API to use only bearer token authentication.
config.SuppressDefaultHostAuthentication();
config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));
config.EnableCors();
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
Startup.IocContainer.WithWebApi(config);
Startup.IocContainer.RegisterWebApiControllers(config);
}
}
Its working great, until I forget to create a mapping in the IOC Container. In which case the Dependency resolver fails to make an instance of the APIController using DryIOC.
When this happens it falls back to the default WebAPI resolver which then barfs with the "No default constructor" error.
This is undesirable behavior for me. If the DryIOC resolution fails, I want things to stop there - no fallback to the default implementation, and no inaccurate message about no default constructor. I want to know what's types DryIOC couldn't resolve so I can fix it.
How can I achieve this?