Fluent-API to add ActionFilters to Controllers – ASP.NET MVC Part 2

I’m working with my Fluent-API for adding Action Filters to Controllers and Action Methods. In my previous post, I created a new instance of each Action Filter and add it to an Action Method or Controller. Based on how the Action Filters are often implemented they don’t or shouldn’t keep any state, so in that case I don’t need to create a new instance of the same Action Filter with the same configuration for each Action Method I want to add it to. I also want to have an option to have a better overview of which Action Filter is added to which Controllers and Action Methods. I have added to methods, AddFilterToControllers and AddFilterToActions:

            .AddFilterToActions(new HandleErrorAttribute(),
                                c=> c.About(),
                                c=> c.Index());
            .AddFilterToActions(new OutOfMemoryException(),
                                c=> c.About());
             .AddFilterToActions(new HandleErrorAttribute() { ... },
                                c=> c.MyMethod());

The code is not yet available due to some more changes and testing.

Published Saturday, November 07, 2009 10:39 AM by Fredrik N
Filed under: ,

Comments

# Fluent-API to add ActionFilters to Controller in ASP.NET MVC - Fredrik Norm??n

Pingback from  Fluent-API to add ActionFilters to Controller in ASP.NET MVC - Fredrik Norm??n

# Twitter Trackbacks for Fluent-API to add ActionFilters to Controllers ??? ASP.NET MVC Part 2 - Fredrik Norm??n [asp.net] on Topsy.com

Pingback from  Twitter Trackbacks for                 Fluent-API to add ActionFilters to Controllers ??? ASP.NET MVC Part 2 - Fredrik Norm??n         [asp.net]        on Topsy.com

# Fluent-API to add ActionFilters to Controllers – ASP.NET MVC Part 2 - Fredrik Normén

Sunday, November 08, 2009 12:34 AM by Servefault.com

Thank you for submitting this cool story - Trackback from Servefault.com

# Dew Drop – November 8, 2009 | Alvin Ashcraft's Morning Dew

Pingback from  Dew Drop – November 8, 2009 | Alvin Ashcraft's Morning Dew

# ASP.NET MVC Archived Blog Posts, Page 1

Tuesday, November 10, 2009 12:13 AM by ASP.NET MVC Archived Blog Posts, Page 1

Pingback from  ASP.NET MVC Archived Blog Posts, Page 1

# Fluent-API to add ActionFilters to Controllers – ASP.NET MVC Part 3

Tuesday, November 10, 2009 1:04 PM by Fredrik Normén

The latest source code for my Fluent-API to add Action Filters to Controllers is no available here .

# Fluent-API to add ActionFilters to Controllers – ASP.NET MVC Part 3

Tuesday, November 10, 2009 1:07 PM by Fredrik Normén

The latest source code for my Fluent-API to add Action Filters to Controllers is no available here .

# Fluent-API to add ActionFilters to Controllers – ASP.NET MVC Part 3

Tuesday, November 10, 2009 1:19 PM by Cornerstones utvecklarblogg

The latest source code for my Fluent-API to add Action Filters to Controllers is no available here .

Leave a Comment

(required) 
(required) 
(optional)
(required)