mrController.MetaDescriptor.Actions[currentActionName] might be an IList of MethodInfo (when you have action overloads, on a SmartDispatcherController). In that case, you'd need a way to retrieve the selected MethodInfo. The Action's name alone would not suffice. Avishay's concern (it's also mine) could be addressed wither by a way of getting hold of the selected MethodInfo (or ActionMetaDescription), or othrwise by adding Action-Level filters to the mix, which IMO is the easier way out, and will be useful on other scenarios also
On Tue, Aug 4, 2009 at 5:22 PM, Mauricio Scheffer < [email protected]> wrote: > > Take a look at this: > http://randomcode.net.nz/2008/03/03/adding-action-filters-to-monorail-controllers/ > > Not an perfect implementation, but it works very well. > > On Aug 4, 10:00 am, Avish <[email protected]> wrote: > > Hi. I hope this is the right place for this. > > > > I want to apply a cross-cutting concern selectively to a set of > > controller actions. Normally I'd use a filter, but these can only be > > applied on the controller level. My questions are: > > > > 1. Is there a good reason why filters can't be declared on a per- > > action basis (as in other than "nobody implemented it yet")? > > > > 2. I could mimic an action-level filter using a controller-level > > filter by reading other attributes from the action itself, but the > > problem is I can't find the selected action at the time the filter > > runs (the ControllerContext gives me the action name, but that could > > map to any number of overloads on a SmartDispatcherController). The > > filter is run after the specific overload has been selected, so is > > there a way to get to it? Anything from MethodInfo to > > ActionMetaDescriptor to IExectuableAction would do. > > > -- Ken Egozi. http://www.kenegozi.com/blog http://www.delver.com http://www.musicglue.com http://www.castleproject.org http://www.gotfriends.co.il --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
