Last post Jan 09, 2008 03:31 AM by Haacked
Dec 19, 2007 09:20 PM|francois_tanguay|LINK
Could (Should) InvokeActionMethod return the result of the call to the actual [ControllerAction] decorated method?
From what I see, there is nothing preventing this method from having a return type other than void.
Hence, using some sort of convention, the return value could be fed as ViewData.
Ideally, the return value from InvokeActionMethod should also be passed to OnPostAction(...) so we're able to automatically call RenderView(...)
public class EmployeesController : Controller
public IEnumerable<Employee> List()
protected virtual override OnPostAction(string actionName, MethodInfo methodInfo, object actionResult)
RenderView(actionName, actionResult); // actionResult will contain IEnumerable<Employee>
Dec 19, 2007 10:39 PM|abombss|LINK
There is nothing stopping you from doing that. I have never seen anything like it before in a MVC framework.
Why not just have the action set the view data?
What are you gaining from the return value misdirection?
Jan 04, 2008 03:41 AM|tgmdbm|LINK
Could someone on the team possibly comment on this? Seems like this would be trivial to implement and could be quite useful.
Jan 09, 2008 03:31 AM|Haacked|LINK
I'm not sure I see what advantages this approach provides. Are there scenarios that this allows that are currently impossible?
Having yet another way to return viewdata potentially creates more confusion.