Exemple #1
0
        // Entrypoint to the pipeline
        protected virtual void ExecuteBridgePipeline()
        {
            // Make the calls to all other bridge methods first
            BridgeMethodInfo methodInfo = GetMethodInfoForCall(BridgeRequest.Method);

            foreach (BridgeChainRequestInfo callInfo in methodInfo.BridgeChainRequests)
            {
                Dictionary <string, object> args = new Dictionary <string, object>();
                ResolveParameters(callInfo.Parameters, args, Context);
                BridgeRequest request = new BridgeRequest(callInfo.Method, args);
                object        results = BridgeHandler.Invoke(callInfo.BridgeUrl, request);
                Context.ResultsChain[callInfo.Name] = results;
            }

            TransformRequest();

            // Stop execution if we have a cache hit
            if (ResolveRequestCache())
            {
                return;
            }

            ProcessRequest();
            TransformResponse();
            UpdateResponseCache();
        }
Exemple #2
0
        public static object Invoke(string bridgeUrl, BridgeRequest request)
        {
            bridgeUrl = VirtualPathUtility.ToAbsolute(bridgeUrl);

            Type type = BuildManager.GetCompiledType(bridgeUrl);

            if (type == null || !typeof(BridgeHandler).IsAssignableFrom(type))
            {
                throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, PreviewWeb.BridgeHandler_CannotLoad, bridgeUrl));
            }
            BridgeHandler bridge = Activator.CreateInstance(type) as BridgeHandler;

            if (bridge == null)
            {
                throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, PreviewWeb.BridgeHandler_CannotCreate, bridgeUrl));
            }
            return(bridge.Invoke(request));
        }