Can the controller take an interface instance as a parameter ? ASP .NET MVC

Posted by driis on Stack Overflow See other posts from Stack Overflow or by driis
Published on 2010-03-20T17:32:57Z Indexed on 2010/03/20 17:51 UTC
Read the original article Hit count: 224

Filed under:
|

Can a ASP .NET Controller action method take an interface as one of the parameters ?

I would like to have something like:

class MyController 
{
    [HttpPost]
    public ActionResult Action(IMyModel model) {...}
}

Is it possible ? Obviously I would have to tell the framework which concrete implementation of IMyModel that should be instantiated, but how ?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about c#