Skip to content

Instantly share code, notes, and snippets.

@jglozano
Created October 15, 2010 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jglozano/627801 to your computer and use it in GitHub Desktop.
Save jglozano/627801 to your computer and use it in GitHub Desktop.
// Fluent Filters
public class MyGlobalFilters : GlobalFilterRegistry {
public MyGlobalFilters() {
AsGlobal<GlobalFilter>();
}
}
public class HomeFilters : ControllerFilterRegistry<HomeController> {
public HomeFilters() {
// Set a Controller wide filter
With<HomeFilter>()
// Set an filter to an specific action
.ForAction<HomeActionFilter>(c => c.Index(null, null));
}
}
// Fluent Binders
public class FooBinders: ModelBinderRegistry {
public FooBinders: () {
Bind<Foo, FooBinder>();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment