Passing parameters in Filters

Nov 6, 2011 at 8:30 AM

Since the Add method is templated, we can't pass any parameters into its costructor.
Have you plan to implement this?


Jun 24, 2012 at 9:41 PM
Edited Jun 24, 2012 at 9:46 PM
Hi! I'm sorry. I have missed your message in last year and just noticed that you message here.
Regarding your question, it's already there. On the library you have few overloaded methods Add:
// Register filter by type
void Add<T>()
void Add<T>(int order)
void Add<T>(Action<IFilterCriteriaBuilder> criteria)
void Add<T>(Action<IFilterCriteriaBuilder> criteria, int order)

// Register filter by instance
void Add(object filter, Action<IFilterCriteriaBuilder> criteria) 
void Add(object filter, Action<IFilterCriteriaBuilder> criteria, int order)
By using registration, for instance, you can set values for the properties:
fluentFilters.Add( new HandleErrorAttribute() { View = "ErrorPage" }, c => { c.Require(new AreaFilterCriteria("Admin"))} );