예제 #1
0
        internal Task FindRoutes(JasperRuntime runtime, JasperRegistry registry, PerfTimer timer)
        {
            var applicationAssembly = registry.ApplicationAssembly;
            var generation          = registry.CodeGeneration;

            return(FindActions(applicationAssembly).ContinueWith(t =>
            {
                timer.Record("Find Routes", () =>
                {
                    var actions = t.Result;
                    foreach (var methodCall in actions)
                    {
                        Routes.AddRoute(methodCall);
                    }

                    if (_transport.ListeningEnabled)
                    {
#pragma warning disable 4014
                        Routes.AddRoute <TransportEndpoint>(nameof(TransportEndpoint.put__messages),
                                                            _transport.RelativeUrl).Route.HttpMethod = "PUT";


                        Routes.AddRoute <TransportEndpoint>(nameof(TransportEndpoint.put__messages_durable),
                                                            _transport.RelativeUrl.AppendUrl("durable")).Route.HttpMethod = "PUT";

#pragma warning restore 4014
                    }
                });

                var rules = timer.Record("Fetching Conneg Rules",
                                         () => runtime.Container.QuickBuild <ConnegRules>());

                timer.Record("Build Routing Tree", () => { Routes.BuildRoutingTree(rules, generation, runtime); });
            }));
        }
예제 #2
0
 public Task Activate(JasperRuntime runtime, IGenerationConfig generation)
 {
     return(Task.Factory.StartNew(() =>
     {
         Routes.BuildRoutingTree(generation, runtime.Container);
     }));
 }
예제 #3
0
        // Call this from the activator
        internal Task BuildRouting(IContainer container, JasperGenerationRules generation)
        {
            if (!Enabled)
            {
                return(Task.CompletedTask);
            }

            return(_findActions.ContinueWith(t => { Routes.BuildRoutingTree(generation, container); }));
        }
예제 #4
0
        internal Task FindRoutes(JasperRuntime runtime, JasperRegistry registry, PerfTimer timer)
        {
            var applicationAssembly = registry.ApplicationAssembly;
            var generation          = registry.CodeGeneration;

            return(FindActions(applicationAssembly).ContinueWith(t =>
            {
                timer.Record("Find Routes", () =>
                {
                    var actions = t.Result;
                    foreach (var methodCall in actions)
                    {
                        Routes.AddRoute(methodCall);
                    }
                });

                var rules = timer.Record("Fetching Conneg Rules",
                                         () => runtime.Container.QuickBuild <ConnegRules>());

                timer.Record("Build Routing Tree", () => { Routes.BuildRoutingTree(rules, generation, runtime); });
            }));
        }