public static void RegisterProvider(FilterProviderCollection providerCollection) { var filterProvider = FluentMvcConfiguration .ConfigureFilterProvider(x => { x.WithResultFactory<ActionResultFactory>() .WithResultFactory<JsonResultFactory>() .WithResultFactory<ViewResultFactory>(isDefault: true); x.WithResultFactory<ErrorThrowingResultFactory>( Apply.For<HomeController>(hc => hc.ErrorResultFactory())); x.WithFilter<HandleErrorAttribute>(); x.WithFilter<AuthorizeAttribute>( Except .For<AccountController>(ac => ac.LogOn()) .AndFor<AccountController>( ac => ac.LogOn(null, null, false, null)) .AndFor<HomeController>()); x.WithFilter<ErrorThrowingFilter>( Apply.When<ExpectsHtml>().For<HomeController>(hc => hc.About())); }); providerCollection.Insert(0, filterProvider); }
public static void RegisterProvider(FilterProviderCollection providerCollection) { var filterProvider = FluentMvcConfiguration .ConfigureFilterProvider(x => { x.WithResultFactory <ActionResultFactory>() .WithResultFactory <JsonResultFactory>() .WithResultFactory <ViewResultFactory>(isDefault: true); x.WithResultFactory <ErrorThrowingResultFactory>( Apply.For <HomeController>(hc => hc.ErrorResultFactory())); x.WithFilter <HandleErrorAttribute>(); x.WithFilter <AuthorizeAttribute>( Except .For <AccountController>(ac => ac.LogOn()) .AndFor <AccountController>( ac => ac.LogOn(null, null, false, null)) .AndFor <HomeController>()); x.WithFilter <ErrorThrowingFilter>( Apply.When <ExpectsHtml>().For <HomeController>(hc => hc.About())); }); providerCollection.Insert(0, filterProvider); }