Example #1
0
        private IOutputObjectAccessorProvider GetAccessorProvider(OutputObjectAccessorRequest accessorRequest)
        {
            if (accessorRequest == null)
            {
                throw new ArgumentNullException(nameof(accessorRequest));
            }

            if (accessorProviderFactory.CanCreateService(accessorRequest.ObjectProviderName) == false)
            {
                throw new NotSupportedException($"Object provider [{accessorRequest.ObjectProviderName}] not supported.");
            }

            return(accessorProviderFactory.CreateService(accessorRequest.ObjectProviderName, serviceProvider));
        }
        public Task <Core.Models.ExecutionContext> RouteRequestAsync(ExecutionRequest execRequest, CancellationToken cancelToken)
        {
            if (execRequest == null)
            {
                throw new ArgumentNullException(nameof(execRequest));
            }

            // If this hub doesn't support a specific execution model, throw an exception and let the
            // execution API communicate the failure back to the client appropriately.

            if (processorFactory.CanCreateService(execRequest.ExecutionModelName) == false)
            {
                throw new NotSupportedException($"Execution model [{execRequest.ExecutionModelName}] not supported.");
            }

            // Otherwise, create the processor and dispatch the execution request.

            var processor = processorFactory.CreateService(execRequest.ExecutionModelName, serviceProvider);

            return(processor.ProcessRequestAsync(execRequest, cancelToken));
        }