Example #1
0
        public List <Frame> DetermineFrames(ConnegRules rules, JasperGenerationRules codeRules)
        {
            if (_hasDeterminedFrames)
            {
                throw new InvalidOperationException("Has already determined frames");
            }

            _hasDeterminedFrames = true;

            if (!_hasAppliedConfigureAndAttributes)
            {
                rules.Apply(this);
                _hasAppliedConfigureAndAttributes = true;
                applyAttributesAndConfigureMethods(codeRules);
            }

            var list = Middleware.ToList();

            list.AddRange(Route.Segments.OfType <IRoutingFrameSource>().Select(x => x.ToParsingFrame(Action)));


            list.Add(Action);

            list.AddRange(Postprocessors);

            return(list);
        }
Example #2
0
        public RouteHandler Build(RouteChain chain)
        {
            _rules.Apply(chain);

            var generatedAssembly = new GeneratedAssembly(_generation);

            chain.AssemblyType(generatedAssembly);

            _container.CompileWithInlineServices(generatedAssembly);

            var handler = chain.CreateHandler(_container);

            handler.Chain = chain;


            return(handler);
        }
Example #3
0
        public void BuildRoutingTree(ConnegRules rules, GenerationRules generation, JasperRuntime runtime)
        {
            assertNoDuplicateRoutes();

            foreach (var chain in _chains)
            {
                rules.Apply(chain);
            }

            var handlers = CompileAndBuildAll(generation, runtime.Get);

            foreach (var handler in handlers)
            {
                var route = handler.Chain.Route;
                route.Handler = handler;
                Router.Add(route);
            }
        }
Example #4
0
        public List <Frame> DetermineFrames(ConnegRules rules)
        {
            if (!_hasAppliedConfigureAndAttributes)
            {
                rules.Apply(this);
                _hasAppliedConfigureAndAttributes = true;
                applyAttributesAndConfigureMethods();
            }

            var list = Middleware.ToList();

            list.AddRange(Route.Segments.OfType <IRoutingFrameSource>().Select(x => x.ToParsingFrame(Action)));


            list.Add(Action);

            list.AddRange(Postprocessors);

            return(list);
        }
Example #5
0
        public List <Frame> DetermineFrames(ConnegRules rules, GenerationRules codeRules, IContainer container)
        {
            if (_hasDeterminedFrames)
            {
                throw new InvalidOperationException("Has already determined frames");
            }

            _hasDeterminedFrames = true;

            if (!_hasAppliedConfigureAndAttributes)
            {
                rules.Apply(this);
                _hasAppliedConfigureAndAttributes = true;
                applyAttributesAndConfigureMethods(codeRules, container);
            }

            var list = Middleware.ToList();

            var arguments = Route.Segments.OfType <IRoutingFrameSource>();

            foreach (var argument in arguments)
            {
                if (Action.Method.Name == "Put" && Action.HandlerType.Name == "ValuesController")
                {
                    Debug.Assert(true);
                }

                var frame = argument.ToParsingFrame(Action);
                list.Add(frame);
            }


            list.Add(Action);

            list.AddRange(Postprocessors);

            return(list);
        }