Q:

Use both MVC Controller and Web ApiController in MVC project?

I have a relatively large project created originally in MVC 4. But I would like to leverage OData functionality for table sorting etc. 
At the moment I am using Windsor Castle to resolve my MVC Controllers.
http://blog.devdave.com/2013/04/castle-windsor-in-aspnet-mvc-4.html
If I inherit a controller from ApiController - it doesn't get resolved because:
IController System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType)

method is passed null controllerType.
What I would like to achieve is to simply return IQuerable and let the ApiController do the paging and filtering by OData standards.
public class OdataController : ApiController
{
    [EnableQuery]
    public IQueryable<Employee> Get()
    {
        using (var repo = _factory.CreateRepository())
        {
            return repo.FilterAsQueryable<Employee>(x => true);
        }
    }
}

Is it possible to achieve this in one project?

A:

You certainly can use web api and mvc controllers in the same project and have them resolve dependencies via your Castle Windsor container. 
However, web api controllers are not created from the same controller factory as mvc controllers. 
You will need to create a class that implements the IDependencyResolver interface, from the System.Web.Http.Dependencies assembly. Have this class use your container.
The syntax on how you set the dependency resolver for WebApi depends on the version of WebApi that you are using.
WebApi 1
GlobalConfiguration.Configuration.DependencyResolver = new MyCastleWindsorResolver();

Please see this blog post
WebApi 2
var config = new HttpConfiguration();
// set up routing and other web api config and what have you
// ....
// register dependency resolver
config.DependencyResolver = new MyCastleWindsorResolver()

