MEFContrib.MVC3 Importing Controllers with Base Class

Sep 1, 2011 at 11:22 PM
Edited Sep 3, 2011 at 12:48 AM

It appears that, when my controllers inherit from a base class (which inherits Controller), my controllers are not automatically found.  I can change my controller to inherit from Controller and everything works just fine.  They are located in a separate assembly than the MVC3 application and I have not tried it (yet) inside the same assembly.  Do I need to do anything to get MEFContrib.MVC3 play nicely with a base class?  I have exported the controllers with both [Export (typeof (IController))] and [Export (typeof (Controller))].  I assume I may need to create my own part catalog or convention catalog but am hoping this wil work out of the box.  (I really love using it so far!)

public class MyBaseController : Controller
{
    ...
}

//  This controller cannot be found.
public class HomeController : MyBaseController
{
    public ActionResult Index ()
    {
        // Do Stuff
        return View ();
    }
}

// This controller can be found.
public class HomeController : Controller
{
    // yada, yada, yada...
}

Edit:

It appears that I have some unresolved dependencies causing me issues. This question can be disregarded for now,

Oct 11, 2011 at 6:38 AM

Ok cool, thanks for letting us know!