Web Api (beta) and Castle.Windsor …without IDependencyResolver ?
I’ve been reading through several blog post about how people configure DI support in the new ASP.NET Web Api. For example you can read about it here :
- Official “Using the Web API Dependency Resolver”
- “Autofac ASP.NET Web API (Beta) Integration“
- “Web Api and Ninject”
What stands out is that every implementation relays on System.Web.Http.Services.IDependencyResolver interface which is similar to the one introduced in the ASP.NET MVC 3 and which lives in the System.Web.Mvc namespace to avoid confusion. Let’s look at it’s implementation details :
public interface IDependencyResolver { object GetService(System.Type serviceType); IEnumerable<object> GetServices(System.Type serviceType); }