I have a project which until recently was 100% ASP.NET MVC5 using Autofac as the DI. I now have a requirement to add a piece of Web API functionality so I have created a new Web API Project inside the solution to sit alongside the MVC project. I am intending to make use of the existing service layer which is in a third project.
My Autofac registration is all in the MVC project. I have spent most of today researching into using Autofac with Web API and I can see how to do it with stand-alone projects, and I can see how to do it with projects that are both MVC and Web API (answered in this SO question). But I can not see how I can set the DI container (built in the MVC project) as the DependencyResolver
in the WebAPI project.
Is it possible to register a container across projects in this way?