public ControllerActionInvokerProvider(
     IControllerFactory controllerFactory,
     IEnumerable<IFilterProvider> filterProviders,
     IControllerActionArgumentBinder argumentBinder,
     IOptions<MvcOptions> optionsAccessor,
     IActionBindingContextAccessor actionBindingContextAccessor,
     ILoggerFactory loggerFactory,
     TelemetrySource telemetry)
 {
     _controllerFactory = controllerFactory;
     _filterProviders = filterProviders.OrderBy(item => item.Order).ToArray();
     _argumentBinder = argumentBinder;
     _inputFormatters = optionsAccessor.Value.InputFormatters.ToArray();
     _outputFormatters = optionsAccessor.Value.OutputFormatters.ToArray();
     _modelBinders = optionsAccessor.Value.ModelBinders.ToArray();
     _modelValidatorProviders = optionsAccessor.Value.ModelValidatorProviders.ToArray();
     _valueProviderFactories = optionsAccessor.Value.ValueProviderFactories.ToArray();
     _actionBindingContextAccessor = actionBindingContextAccessor;
     _maxModelValidationErrors = optionsAccessor.Value.MaxModelValidationErrors;
     _logger = loggerFactory.CreateLogger<ControllerActionInvoker>();
     _telemetry = telemetry;
 }
 public TestControllerActionInvoker(
     ActionContext actionContext,
     IFilterProvider[] filterProvider,
     MockControllerFactory controllerFactory,
     ControllerActionDescriptor descriptor,
     IReadOnlyList<IInputFormatter> inputFormatters,
     IReadOnlyList<IOutputFormatter> outputFormatters,
     IControllerActionArgumentBinder controllerActionArgumentBinder,
     IReadOnlyList<IModelBinder> modelBinders,
     IReadOnlyList<IModelValidatorProvider> modelValidatorProviders,
     IReadOnlyList<IValueProviderFactory> valueProviderFactories,
     IActionBindingContextAccessor actionBindingContext,
     ILogger logger,
     TelemetrySource telemetry,
     int maxAllowedErrorsInModelState)
     : base(
           actionContext,
           filterProvider,
           controllerFactory,
           descriptor,
           inputFormatters,
           outputFormatters,
           controllerActionArgumentBinder,
           modelBinders,
           modelValidatorProviders,
           valueProviderFactories,
           actionBindingContext,
           logger,
           telemetry,
           maxAllowedErrorsInModelState)
 {
     ControllerFactory = controllerFactory;
 }
Beispiel #3
0
        private void EnsureServices(HttpContext context)
        {
            if (_actionContextAccessor == null)
            {
                _actionContextAccessor = context.RequestServices.GetRequiredService<IActionContextAccessor>();
            }

            if (_actionInvokerFactory == null)
            {
                _actionInvokerFactory = context.RequestServices.GetRequiredService<IActionInvokerFactory>();
            }

            if (_actionSelector == null)
            {
                _actionSelector = context.RequestServices.GetRequiredService<IActionSelector>();
            }

            if (_logger == null)
            {
                var factory = context.RequestServices.GetRequiredService<ILoggerFactory>();
                _logger = factory.CreateLogger<MvcRouteHandler>();
            }

            if (_telemetry == null)
            {
                _telemetry = context.RequestServices.GetRequiredService<TelemetrySource>();
            }
        }