Beispiel #1
0
        private static bool AllowMultiple(object filterInstance)
        {
            IMvcFilter mvcFilter = filterInstance as IMvcFilter;

            if (mvcFilter == null)
            {
                return(true);
            }

            return(mvcFilter.AllowMultiple);
        }
Beispiel #2
0
        public Filter(object instance, FilterScope scope, int?order)
        {
            Precondition.Require(instance, () => Error.ArgumentNull("instance"));

            if (!order.HasValue)
            {
                IMvcFilter filter = (instance as IMvcFilter);
                order = (filter == null) ? DefaultOrder : filter.Order;
            }

            _instance = instance;
            _order    = order.Value;
            _scope    = scope;
        }
Beispiel #3
0
        public static void Init()
        {
            List <String> filter = MvcConfig.Instance.Filter;

            foreach (String t in filter)
            {
                IMvcFilter f = ObjectContext.GetByType(t) as IMvcFilter;
                if (f == null)
                {
                    continue;
                }
                f.Process(MvcEventPublisher.Instance);
            }
        }
Beispiel #4
0
 public Filter(object instance, FilterScope scope, int?order)
 {
     if (instance == null)
     {
         throw new ArgumentNullException("instance");
     }
     if (!order.HasValue)
     {
         IMvcFilter mvcFilter = instance as IMvcFilter;
         if (mvcFilter != null)
         {
             order = new int?(mvcFilter.Order);
         }
     }
     this.Instance = instance;
     this.Order    = (order ?? -1);
     this.Scope    = scope;
 }
Beispiel #5
0
        public Filter(object instance, FilterScope scope, int?order)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }

            if (order == null)
            {
                IMvcFilter mvcFilter = instance as IMvcFilter;
                if (mvcFilter != null)
                {
                    order = mvcFilter.Order;
                }
            }

            Instance = instance;
            Order    = order ?? DefaultOrder;
            Scope    = scope;
        }
        private static bool AllowMultiple(object instance)
        {
            IMvcFilter filter = (instance as IMvcFilter);

            return((filter == null) ? true : filter.AllowMultiple);
        }