public BridgeContext(BridgeRequest request, string bridgeUrl) { if (request == null) { throw new ArgumentNullException("request"); } _request = request; _bridgeUrl = bridgeUrl; }
// 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(); }
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)); }
protected void BuildBridgeContext(string bridgePath, BridgeRequest request) { _context = new BridgeContext(request, bridgePath); }
// Public invocation of the entry point public object Invoke(BridgeRequest request) { BuildBridgeContext(VirtualPath, request); ExecuteBridgePipeline(); return(BridgeResponse.Response); }
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); }
// Public invocation of the entry point public object Invoke(BridgeRequest request) { BuildBridgeContext(VirtualPath, request); ExecuteBridgePipeline(); return BridgeResponse.Response; }
// 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(); }