the best approach is described by Phil Haack.
This is basically what you do:
public class AddActionParameterAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { base.OnActionExecuting(filterContext);
The only result is that if you create object parameters, then your class (in this case Person) must have a default constructor, otherwise you will get an exception.
Here you can use the filter above:
[AddActionParameter] public ActionResult Index(int number, Person person) {
niaher Nov 28 '12 at 18:23 2012-11-28 18:23
source share