views:

36

answers:

0

Hello!
My question is fairly simple: I have a custom ActionFilterAttribute which looks like this (simplified for readability):

public class DynamicModuleActionAttribute : ActionFilterAttribute {
    public override void OnActionExecuting(ActionExecutingContext filterContext) {
        filterContext.ActionParameters["module"] = new MyObject();
        base.OnActionExecuting(filterContext);
    }
}

Then, my controller action should look like this:

[DynamicModuleAction]
public ActionResult Edit(Module module) {
    // do some logic here
    return View();
}

With this code, I'm getting an ArgumentNullException in the DefaultModelBinder.
Of course I could receive an object module in the action and then cast it to Module, but, obviously, I'm trying to avoid this workaround.

Any clues?
Thanks everyone!