static void AddFilter(IMatchOperation matchOperation)
 {
     var thisClassType = typeof(ResourcesProvider);
     var method = thisClassType.GetMethod("AddTypedFilter", BindingFlags.NonPublic | BindingFlags.Static);
     if (method == null)
         throw new NullReferenceException("Cannot find method 'AddTypedFilter'");
     var typedMethod = method.MakeGenericMethod(matchOperation.filterType);
     typedMethod.Invoke(null, new object[] { matchOperation });
 }
示例#2
0
        private IMatchOperation [] OpsForPatterns(string [] patterns, MatchType type)
        {
            var ops = new IMatchOperation [patterns.Length];

            for (int i = 0; i < ops.Length; i++)
            {
                ops [i] = MatchOperationFactory.Create(patterns [i], type);
            }

            return(ops);
        }
示例#3
0
        static void AddTypedFilter <T>(IMatchOperation matchOperation)
        {
            var typedMatchOperation = (MatchOperation <T>)matchOperation;

            s_QueryEngine.AddFilter(typedMatchOperation.matchToken, typedMatchOperation.getFilterData);
        }
示例#4
0
        private IMatchOperation[] OpsForPatterns(string [] patterns, MatchType type)
        {
            var ops = new IMatchOperation [patterns.Length];
            for (int i = 0; i < ops.Length; i++) {
                ops [i] = MatchOperationFactory.Create (patterns [i], type);
            }

            return ops;
        }
示例#5
0
        private RouteHandler AddRouteHandler(IManosTarget target, IMatchOperation[] matchOperations, HttpMethod [] methods)
        {
            // TODO: Need to decide if this is a good or bad idea
            // RemoveImplicitHandlers (action);

            if (target == null)
                throw new ArgumentNullException ("action");
            if (matchOperations == null)
                throw new ArgumentNullException ("matchOperations");
            if (methods == null)
                throw new ArgumentNullException ("methods");

            RouteHandler res = new RouteHandler (matchOperations, methods, target);
            Routes.Children.Add (res);
            return res;
        }
示例#6
0
 private RouteHandler AddRouteHandler(ManosAction action, IMatchOperation[] matchOperations, HttpMethod [] methods)
 {
     return AddRouteHandler (new ActionTarget (action), matchOperations, methods);
 }
示例#7
0
        private RouteHandler AddImplicitRouteHandlerForTarget(IManosTarget target, IMatchOperation [] ops, HttpMethod [] methods)
        {
            RouteHandler res = new RouteHandler (ops, methods, target) {
                IsImplicit = true,
            };

            Routes.Children.Add (res);
            return res;
        }
示例#8
0
        private RouteHandler AddImplicitRouteHandlerForModule(IManosModule module, IMatchOperation [] ops, HttpMethod [] methods)
        {
            module.StartInternal ();

            module.Routes.IsImplicit = true;
            module.Routes.MatchOps = ops;
            module.Routes.Methods = methods;
            Routes.Children.Add (module.Routes);
            return module.Routes;
        }
示例#9
0
 public RouteHandler(IMatchOperation op, HttpMethod method, IManosTarget target) : this(new IMatchOperation [] { op }, new HttpMethod [] { method }, target)
 {
 }
示例#10
0
 public RouteHandler(IMatchOperation op, HttpMethod method) : this(new IMatchOperation [] { op }, new HttpMethod [] { method })
 {
 }
示例#11
0
 public RouteHandler(IMatchOperation op, HttpMethod [] methods, IManosTarget target) : this(new IMatchOperation [] { op }, methods, target)
 {
 }
示例#12
0
 public RouteHandler(IMatchOperation op, HttpMethod [] methods) : this(new IMatchOperation [] { op }, methods)
 {
 }
示例#13
0
        public void Create_SimpleMatchInMiddle_CreatesSimpleMatch()
        {
            IMatchOperation op = MatchOperationFactory.Create("/Foo/{bar}/");

            Should.BeInstanceOf <SimpleMatchOperation> (op);
        }
示例#14
0
        public void Create_EscapedCloseSimpleMatch_CreatesStringMatch()
        {
            IMatchOperation op = MatchOperationFactory.Create("{bar}}");

            Should.BeInstanceOf <StringMatchOperation> (op);
        }
示例#15
0
        public void Create_SimpleMatchIsWholePattern_CreatesSimpleMatch()
        {
            IMatchOperation op = MatchOperationFactory.Create("{bar}");

            Should.BeInstanceOf <SimpleMatchOperation> (op);
        }
示例#16
0
        public void Create_SimpleMatchAtBeginning_CreatesSimpleMatch()
        {
            IMatchOperation op = MatchOperationFactory.Create("{bar}/Foo");

            Should.BeInstanceOf <SimpleMatchOperation> (op);
        }