Beispiel #1
0
        /// <summary>
        /// Registers the specified filters for the given controller action.
        /// </summary>
        /// <typeparam name="TController">The type of the controller.</typeparam>
        /// <typeparam name="TFilter1">The type of the filter1.</typeparam>
        /// <typeparam name="TFilter2">The type of the filter2.</typeparam>
        /// <param name="instance">The instance.</param>
        /// <param name="action">The controller action method.</param>
        /// <returns></returns>
        public static IFilterRegistry Register <TController, TFilter1, TFilter2>(this IFilterRegistry instance, Expression <Action <TController> > action)
            where TController : Controller
            where TFilter1 : IMvcFilter
            where TFilter2 : IMvcFilter
        {
            Invariant.IsNotNull(instance, "instance");

            return(instance.Register(action, CreateFilterFactories(instance, typeof(TFilter1), typeof(TFilter2)).ToArray()));
        }
Beispiel #2
0
        /// <summary>
        /// Registers the specified filters for the given controller.
        /// </summary>
        /// <typeparam name="TController">The type of the controller.</typeparam>
        /// <typeparam name="TFilter1">The type of the filter1.</typeparam>
        /// <typeparam name="TFilter2">The type of the filter2.</typeparam>
        /// <param name="instance">The instance.</param>
        /// <returns></returns>
        public static IFilterRegistry Register <TController, TFilter1, TFilter2>([NotNull] this IFilterRegistry instance)
            where TController : Controller
            where TFilter1 : IMvcFilter
            where TFilter2 : IMvcFilter
        {
            Invariant.IsNotNull(instance, "instance");

            return(instance.Register <TController, IMvcFilter>(CreateFilterFactories(instance, typeof(TFilter1), typeof(TFilter2)).ToArray()));
        }
Beispiel #3
0
        /// <summary>
        /// Registers and configures the specified filter for the given controller action.
        /// </summary>
        /// <typeparam name="TController">The type of the controller.</typeparam>
        /// <typeparam name="TFilter">The type of the filter.</typeparam>
        /// <param name="instance">The instance.</param>
        /// <param name="action">The controller action method.</param>
        /// <param name="configureFilter">The configure filter.</param>
        /// <returns></returns>
        public static IFilterRegistry Register <TController, TFilter>(this IFilterRegistry instance, Expression <Action <TController> > action, Action <TFilter> configureFilter)
            where TController : Controller
            where TFilter : IMvcFilter
        {
            Invariant.IsNotNull(instance, "instance");
            Invariant.IsNotNull(action, "action");
            Invariant.IsNotNull(configureFilter, "configureFilter");

            return(instance.Register(action, CreateAndConfigureFilterFactory(instance, configureFilter)));
        }
Beispiel #4
0
        public static IFilterRegistry Register <TController, TFilter>([NotNull] this IFilterRegistry instance, [NotNull] Action <TFilter> configureFilter)
            where TController : Controller
            where TFilter : IMvcFilter
        {
            Invariant.IsNotNull(instance, "instance");
            Invariant.IsNotNull(configureFilter, "configureFilter");

            instance.Register <TController, IMvcFilter>(CreateAndConfigureFilterFactory(instance, configureFilter));

            return(instance);
        }