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?