Asp.net MVC 2, MvcContrib, and a base controller with redirect actions

Posted by jeriley on Stack Overflow See other posts from Stack Overflow or by jeriley
Published on 2010-03-17T15:58:18Z Indexed on 2010/03/17 16:01 UTC
Read the original article Hit count: 438

Filed under:
|

I've got a base controller that takes a couple generics, nothing overly fancy.

public class SystemBaseController<TForm, TFormViewModel> : Controller
    where TForm : class, IForm
    where TFormViewModel : class, IViewModel

ok, no big deal. I have a method "CompleteForm" that takes in the viewModel, looks kinda like this ...

    public ActionResult CompleteForm(TFormViewModel viewModel)
    {
          //does some stuff

          return this.RedirectToAction(c => c.FormInfo(viewModel));
    }

Problem is, the controller that inherits this, like so

public class SalesFormController :  SystemBaseController<SalesForm, SalesViewModel>
{ }

I end up getting a error from MvcContrib - Controller name must end in 'Controller' at this point ...

    public RedirectToRouteResult(Expression<Action<T>> expression)
        : this(expression, expr => Microsoft.Web.Mvc.Internal.ExpressionHelper.GetRouteValuesFromExpression(expr)) {}

The expression that's passed in is correct (SystemBaseController blahblah) but I'm not sure why its 1.) saying there's no controller at the end, and 2.) if I pull out everything into the controller (out of the base), works just fine. Do I need to write or setup some kind of action filter of my own or what am I missing?

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2

Related posts about mvccontrib