Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 public void new_configuration()
 {
     var provider = FluentMvcConfiguration.ConfigureFilterProvider(config =>
     {
         config.WithResultFactory <ActionResultFactory>(isDefault: true);
         config.WithFilter <AuthorizeAttribute>();
     });
 }