/// <summary> Registers the dynamic. </summary> /// /// <param name="config"> The configuration. </param> /// <param name="server"> The server. </param> public static async void RegisterDynamic(HttpConfiguration config, HttpServer server) { ODataRoute odataRoute = await config.MapRestierRoute <DynamicApi>( "DynamicApi", "api/Dynamic", new RestierBatchHandler(server)); //for overriding standart metadata class //System.Web.OData.MetadataController odataRoute.PathRouteConstraint.RoutingConventions.Add(new MediadataRoutingConvention()); // Register an Action selector that can include template parameters in the name IHttpActionSelector actionSelectorService = config.Services.GetActionSelector(); config.Services.Replace(typeof(IHttpActionSelector), new DynamicODataActionSelector(actionSelectorService)); // Register an Action invoker that can include template parameters in the name IHttpActionInvoker actionInvokerService = config.Services.GetActionInvoker(); config.Services.Replace(typeof(IHttpActionInvoker), new DynamicODataActionInvoker(actionInvokerService)); // Register an Exception handler that can include template parameters in the name IExceptionHandler exceptionHandler = config.Services.GetExceptionHandler(); config.Services.Replace(typeof(IExceptionHandler), new DynamicExceptionHandler(exceptionHandler)); // Register for Dynamic Actions xlsConverter.Program.ConfigureDynamicActions(config); }
private static void CreateActionInvokerTracer(HttpConfiguration configuration, ITraceWriter traceWriter) { IHttpActionInvoker invoker = configuration.ServiceResolver.GetService(typeof(IHttpActionInvoker)) as IHttpActionInvoker; HttpActionInvokerTracer tracer = new HttpActionInvokerTracer(invoker, traceWriter); configuration.ServiceResolver.SetService(typeof(IHttpActionInvoker), tracer); }
private static void CreateActionInvokerTracer(HttpConfiguration configuration, ITraceWriter traceWriter) { IHttpActionInvoker invoker = configuration.Services.GetActionInvoker(); HttpActionInvokerTracer tracer = new HttpActionInvokerTracer(invoker, traceWriter); configuration.Services.Replace(typeof(IHttpActionInvoker), tracer); }
public HttpActionInvokerTracer(IHttpActionInvoker innerInvoker, ITraceWriter traceWriter) { Contract.Assert(innerInvoker != null); Contract.Assert(traceWriter != null); _innerInvoker = innerInvoker; _traceWriter = traceWriter; }
public HttpActionInvokerTracer(IHttpActionInvoker innerInvoker, ITraceWriter traceWriter) { Contract.Assert(innerInvoker != null); Contract.Assert(traceWriter != null); _innerInvoker = innerInvoker; _traceWriter = traceWriter; }
private static void CreateActionInvokerTracer(HttpConfiguration configuration, ITraceWriter traceWriter) { IHttpActionInvoker invoker = GetService <IHttpActionInvoker>(configuration.Services); if (invoker != null && !(invoker is HttpActionInvokerTracer)) { HttpActionInvokerTracer tracer = new HttpActionInvokerTracer(invoker, traceWriter); configuration.Services.Replace(typeof(IHttpActionInvoker), tracer); } }
public void Inner_Property_On_HttpActionInvokerTracer_Returns_IHttpActionInvoker() { // Arrange IHttpActionInvoker expectedInner = new Mock <IHttpActionInvoker>().Object; HttpActionInvokerTracer productUnderTest = new HttpActionInvokerTracer(expectedInner, new TestTraceWriter()); // Act IHttpActionInvoker actualInner = productUnderTest.Inner; // Assert Assert.Same(expectedInner, actualInner); }
public void Decorator_GetInner_On_HttpActionInvokerTracer_Returns_IHttpActionInvoker() { // Arrange IHttpActionInvoker expectedInner = new Mock <IHttpActionInvoker>().Object; HttpActionInvokerTracer productUnderTest = new HttpActionInvokerTracer(expectedInner, new TestTraceWriter()); // Act IHttpActionInvoker actualInner = Decorator.GetInner(productUnderTest as IHttpActionInvoker); // Assert Assert.Same(expectedInner, actualInner); }
private void Initialize() { // Look for attribute to provide specialized information for this controller type HttpControllerConfigurationAttribute controllerConfig = _controllerType.GetCustomAttributes <HttpControllerConfigurationAttribute>(inherit: true).FirstOrDefault(); // If we find attribute then first ask dependency resolver and if we get null then create it ourselves if (controllerConfig != null) { if (controllerConfig.HttpControllerActivator != null) { _controllerActivator = GetService <IHttpControllerActivator>(_configuration, controllerConfig.HttpControllerActivator); } if (controllerConfig.HttpActionSelector != null) { _actionSelector = GetService <IHttpActionSelector>(_configuration, controllerConfig.HttpActionSelector); } if (controllerConfig.HttpActionInvoker != null) { _actionInvoker = GetService <IHttpActionInvoker>(_configuration, controllerConfig.HttpActionInvoker); } if (controllerConfig.ActionValueBinder != null) { _actionValueBinder = GetService <IActionValueBinder>(_configuration, controllerConfig.ActionValueBinder); } } // For everything still null we call the dependency resolver as normal. if (_controllerActivator == null) { _controllerActivator = Configuration.ServiceResolver.GetHttpControllerActivator(); } if (_actionSelector == null) { _actionSelector = Configuration.ServiceResolver.GetActionSelector(); } if (_actionInvoker == null) { _actionInvoker = Configuration.ServiceResolver.GetActionInvoker(); } if (_actionValueBinder == null) { _actionValueBinder = Configuration.ServiceResolver.GetActionValueBinder(); } }
public MediaDataControllerTests() { if (ConfigurationManager.AppSettings["TestServiceURL"] != null) { testServiceURL = ConfigurationManager.AppSettings["TestServiceURL"]; } if (string.IsNullOrEmpty(testServiceURL)) { testServiceURL = DynamicControllerTests.cDefaultBaseURL; var configuration = new HttpConfiguration(); Task <System.Web.OData.Routing.ODataRoute> odataRoute = configuration.MapRestierRoute <DynamicApi>("DynamicApi", "DynamicApi"); odataRoute.Wait(); odataRoute.Result.PathRouteConstraint.RoutingConventions.Add(new ODataRestierDynamic.DynamicFactory.MediadataRoutingConvention()); // Register an Action selector that can include template parameters in the name IHttpActionSelector actionSelectorService = configuration.Services.GetActionSelector(); configuration.Services.Replace(typeof(IHttpActionSelector), new DynamicODataActionSelector(actionSelectorService)); // Register an Action invoker that can include template parameters in the name IHttpActionInvoker actionInvokerService = configuration.Services.GetActionInvoker(); configuration.Services.Replace(typeof(IHttpActionInvoker), new DynamicODataActionInvoker(actionInvokerService)); client = new HttpClient(new HttpServer(configuration)); } else { var handler = new HttpClientHandler { UseDefaultCredentials = true }; client = new HttpClient(handler); } if (!testServiceURL.EndsWith("/")) { testServiceURL += "/"; } }
public DebugActionInvoker(IHttpActionInvoker httpActionInvoker) { // TODO: Complete member initialization this.httpActionInvoker = httpActionInvoker; }
/// <summary> /// Initializes a new instance of the <see cref="ODataActionSelector" /> class. /// </summary> /// <param name="innerInvoker">The inner controller selector to call.</param> public DynamicODataActionInvoker(IHttpActionInvoker innerInvoker) { _innerInvoker = innerInvoker; }
public InspectActionInvoker(IHttpActionInvoker innerInvoker) { _innerInvoker = innerInvoker; }
public InspectActionInvoker(IHttpActionInvoker delegating) { _delegating = delegating; }
public SuperscribeActionInvokerAdapter(IHttpActionInvoker baseInvoker) { this.baseInvoker = baseInvoker; }
public DebugActionInvoker(IHttpActionInvoker httpActionInvoker) { // TODO: Complete member initialization this.httpActionInvoker = httpActionInvoker; }
public SuperscribeActionInvokerAdapter(IHttpActionInvoker baseInvoker) { this.baseInvoker = baseInvoker; }
/// <summary> /// Initializes a new instance of the <see cref="ODataActionSelector" /> class. /// </summary> /// <param name="innerInvoker">The inner controller selector to call.</param> public DynamicODataActionInvoker(IHttpActionInvoker innerInvoker) { _innerInvoker = innerInvoker; }
public HttpActionInvokerTracer(IHttpActionInvoker innerInvoker, ITraceWriter traceWriter) { _innerInvoker = innerInvoker; _traceWriter = traceWriter; }
public InspectActionInvoker(IHttpActionInvoker innerInvoker) { _innerInvoker = innerInvoker; }
public HttpActionInvokerTracer(IHttpActionInvoker innerInvoker, ITraceWriter traceWriter) { _innerInvoker = innerInvoker; _traceWriter = traceWriter; }