Exemple #1
0
 public ModuleActionInvokerProvider(
     IModuleFactory moduleFactory,
     IEnumerable <IFilterProvider> filterProviders,
     IReadOnlyList <IInputFormatter> inputFormatters,
     IReadOnlyList <IOutputFormatter> outputFormatters,
     IReadOnlyList <IModelBinder> modelBinders,
     IReadOnlyList <IModelValidatorProvider> modelValidatorProviders,
     IReadOnlyList <IValueProviderFactory> valueProviderFactories,
     IActionBindingContextAccessor actionBindingContextAccessor,
     IOptions <MvcOptions> optionsAccessor,
     ILogger logger,
     DiagnosticSource diagnostic,
     IServiceProvider serviceProvider)
 {
     _moduleFactory                = moduleFactory;
     _filterProviders              = filterProviders.OrderBy(p => p.Order).ToList();
     _inputFormatters              = inputFormatters;
     _outputFormatters             = outputFormatters;
     _modelBinders                 = modelBinders;
     _modelValidatorProviders      = modelValidatorProviders;
     _valueProviderFactories       = valueProviderFactories;
     _actionBindingContextAccessor = actionBindingContextAccessor;
     _optionsAccessor              = optionsAccessor;
     _logger          = logger;
     _diagnostic      = diagnostic;
     _serviceProvider = serviceProvider;
 }
Exemple #2
0
        /// <summary>
        /// Creates a new <see cref="ObjectResultExecutor"/>.
        /// </summary>
        /// <param name="options">An accessor to <see cref="MvcOptions"/>.</param>
        /// <param name="bindingContextAccessor">The <see cref="IActionBindingContextAccessor"/>.</param>
        /// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
        public ObjectResultExecutor(
            IOptions <MvcOptions> options,
            IActionBindingContextAccessor bindingContextAccessor,
            IHttpResponseStreamWriterFactory writerFactory,
            ILoggerFactory loggerFactory)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            if (bindingContextAccessor == null)
            {
                throw new ArgumentNullException(nameof(bindingContextAccessor));
            }

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _bindingContextAccessor = bindingContextAccessor;

            OptionsFormatters          = options.Value.OutputFormatters;
            RespectBrowserAcceptHeader = options.Value.RespectBrowserAcceptHeader;
            Logger        = loggerFactory.CreateLogger <ObjectResultExecutor>();
            WriterFactory = writerFactory.CreateWriter;
        }
Exemple #3
0
        public FilterActionInvoker(
            [NotNull] ActionContext actionContext,
            [NotNull] IReadOnlyList <IFilterProvider> filterProviders,
            [NotNull] IReadOnlyList <IInputFormatter> inputFormatters,
            [NotNull] IReadOnlyList <IOutputFormatter> outputFormatters,
            [NotNull] IReadOnlyList <IModelBinder> modelBinders,
            [NotNull] IReadOnlyList <IModelValidatorProvider> modelValidatorProviders,
            [NotNull] IReadOnlyList <IValueProviderFactory> valueProviderFactories,
            [NotNull] IActionBindingContextAccessor actionBindingContextAccessor,
            [NotNull] ILogger logger,
            [NotNull] INotifier notifier,
            int maxModelValidationErrors)
        {
            ActionContext = actionContext;

            _filterProviders              = filterProviders;
            _inputFormatters              = inputFormatters;
            _outputFormatters             = outputFormatters;
            _modelBinders                 = modelBinders;
            _modelValidatorProviders      = modelValidatorProviders;
            _valueProviderFactories       = valueProviderFactories;
            _actionBindingContextAccessor = actionBindingContextAccessor;
            _logger   = logger;
            _notifier = notifier;
            _maxModelValidationErrors = maxModelValidationErrors;
        }
        public DefaultControllerPropertyActivator(IActionBindingContextAccessor actionBindingContextAccessor)
        {
            _actionBindingContextAccessor = actionBindingContextAccessor;

            _activateActions = new ConcurrentDictionary<Type, PropertyActivator<Contexts>[]>();
            _getPropertiesToActivate = GetPropertiesToActivate;
        }
 public ModuleActionInvokerProvider(
     IModuleFactory moduleFactory,
     IEnumerable<IFilterProvider> filterProviders,
     IReadOnlyList<IInputFormatter> inputFormatters,
     IReadOnlyList<IOutputFormatter> outputFormatters,
     IReadOnlyList<IModelBinder> modelBinders,
     IReadOnlyList<IModelValidatorProvider> modelValidatorProviders,
     IReadOnlyList<IValueProviderFactory> valueProviderFactories,
     IActionBindingContextAccessor actionBindingContextAccessor,
     IOptions<MvcOptions> optionsAccessor,
     ILogger logger,
     DiagnosticSource diagnostic,
     IServiceProvider serviceProvider)
 {
     _moduleFactory = moduleFactory;
     _filterProviders = filterProviders.OrderBy(p => p.Order).ToList();
     _inputFormatters = inputFormatters;
     _outputFormatters = outputFormatters;
     _modelBinders = modelBinders;
     _modelValidatorProviders = modelValidatorProviders;
     _valueProviderFactories = valueProviderFactories;
     _actionBindingContextAccessor = actionBindingContextAccessor;
     _optionsAccessor = optionsAccessor;
     _logger = logger;
     _diagnostic = diagnostic;
     _serviceProvider = serviceProvider;
 }
 public ModuleActionInvoker(
     ActionContext actionContext,
     IReadOnlyList <IFilterProvider> filterProviders,
     IModuleFactory moduleFactory,
     ModuleActionDescriptor descriptor,
     IReadOnlyList <IInputFormatter> inputFormatters,
     IReadOnlyList <IOutputFormatter> outputFormatters,
     IReadOnlyList <IModelBinder> modelBinders,
     IReadOnlyList <IModelValidatorProvider> modelValidatorProviders,
     IReadOnlyList <IValueProviderFactory> valueProviderFactories,
     IActionBindingContextAccessor actionBindingContextAccessor,
     ILogger logger,
     DiagnosticSource diagnostic,
     int maxModelValidationErrors)
     : base(
         actionContext,
         filterProviders,
         inputFormatters,
         outputFormatters,
         modelBinders,
         modelValidatorProviders,
         valueProviderFactories,
         actionBindingContextAccessor,
         logger,
         diagnostic,
         maxModelValidationErrors)
 {
     _descriptor    = descriptor;
     _moduleFactory = moduleFactory;
 }
        /// <summary>
        /// Creates a new <see cref="ObjectResultExecutor"/>.
        /// </summary>
        /// <param name="options">An accessor to <see cref="MvcOptions"/>.</param>
        /// <param name="bindingContextAccessor">The <see cref="IActionBindingContextAccessor"/>.</param>
        /// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
        public ObjectResultExecutor(
            IOptions<MvcOptions> options,
            IActionBindingContextAccessor bindingContextAccessor,
            IHttpResponseStreamWriterFactory writerFactory,
            ILoggerFactory loggerFactory)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            if (bindingContextAccessor == null)
            {
                throw new ArgumentNullException(nameof(bindingContextAccessor));
            }

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _bindingContextAccessor = bindingContextAccessor;

            OptionsFormatters = options.Value.OutputFormatters;
            RespectBrowserAcceptHeader = options.Value.RespectBrowserAcceptHeader;
            Logger = loggerFactory.CreateLogger<ObjectResultExecutor>();
            WriterFactory = writerFactory.CreateWriter;
        }
 public ModuleActionInvoker(
     ActionContext actionContext,
     IReadOnlyList<IFilterProvider> filterProviders,
     IModuleFactory moduleFactory,
     ModuleActionDescriptor descriptor,
     IReadOnlyList<IInputFormatter> inputFormatters,
     IReadOnlyList<IOutputFormatter> outputFormatters,
     IReadOnlyList<IModelBinder> modelBinders,
     IReadOnlyList<IModelValidatorProvider> modelValidatorProviders,
     IReadOnlyList<IValueProviderFactory> valueProviderFactories,
     IActionBindingContextAccessor actionBindingContextAccessor,
     ILogger logger,
     DiagnosticSource diagnostic,
     int maxModelValidationErrors)
     : base(
           actionContext,
           filterProviders,
           inputFormatters,
           outputFormatters,
           modelBinders,
           modelValidatorProviders,
           valueProviderFactories,
           actionBindingContextAccessor,
           logger,
           diagnostic,
           maxModelValidationErrors)
 {
     _descriptor = descriptor;
     _moduleFactory = moduleFactory;
 }
        public DefaultControllerPropertyActivator(IActionBindingContextAccessor actionBindingContextAccessor)
        {
            _actionBindingContextAccessor = actionBindingContextAccessor;

            _activateActions         = new ConcurrentDictionary <Type, PropertyActivator <Contexts>[]>();
            _getPropertiesToActivate = GetPropertiesToActivate;
        }
 public TestObjectResultExecutor(
     IOptions <MvcOptions> options,
     IActionBindingContextAccessor bindingContextAccessor,
     IHttpResponseStreamWriterFactory writerFactory,
     ILoggerFactory loggerFactory)
     : base(options, bindingContextAccessor, writerFactory, loggerFactory)
 {
 }
        public ControllerActionInvoker(
            [NotNull] ActionContext actionContext,
            [NotNull] IReadOnlyList <IFilterProvider> filterProviders,
            [NotNull] IControllerFactory controllerFactory,
            [NotNull] ControllerActionDescriptor descriptor,
            [NotNull] IReadOnlyList <IInputFormatter> inputFormatters,
            [NotNull] IReadOnlyList <IOutputFormatter> outputFormatters,
            [NotNull] IControllerActionArgumentBinder controllerActionArgumentBinder,
            [NotNull] IReadOnlyList <IModelBinder> modelBinders,
            [NotNull] IReadOnlyList <IModelValidatorProvider> modelValidatorProviders,
            [NotNull] IReadOnlyList <IValueProviderFactory> valueProviderFactories,
            [NotNull] IActionBindingContextAccessor actionBindingContextAccessor,
            [NotNull] ILogger logger,
            [NotNull] TelemetrySource telemetry,
            int maxModelValidationErrors)
            : base(
                actionContext,
                filterProviders,
                inputFormatters,
                outputFormatters,
                modelBinders,
                modelValidatorProviders,
                valueProviderFactories,
                actionBindingContextAccessor,
                logger,
                telemetry,
                maxModelValidationErrors)
        {
            _descriptor        = descriptor;
            _controllerFactory = controllerFactory;
            _argumentBinder    = controllerActionArgumentBinder;

            if (descriptor.MethodInfo == null)
            {
                throw new ArgumentException(
                          Resources.FormatPropertyOfTypeCannotBeNull("MethodInfo",
                                                                     typeof(ControllerActionDescriptor)),
                          "descriptor");
            }
        }
 public ControllerActionInvokerProvider(
     IControllerFactory controllerFactory,
     IEnumerable <IFilterProvider> filterProviders,
     IControllerActionArgumentBinder argumentBinder,
     IOptions <MvcOptions> optionsAccessor,
     IActionBindingContextAccessor actionBindingContextAccessor,
     ILoggerFactory loggerFactory,
     INotifier notifier)
 {
     _controllerFactory            = controllerFactory;
     _filterProviders              = filterProviders.OrderBy(item => item.Order).ToArray();
     _argumentBinder               = argumentBinder;
     _inputFormatters              = optionsAccessor.Options.InputFormatters.ToArray();
     _outputFormatters             = optionsAccessor.Options.OutputFormatters.ToArray();
     _modelBinders                 = optionsAccessor.Options.ModelBinders.ToArray();
     _modelValidatorProviders      = optionsAccessor.Options.ModelValidatorProviders.ToArray();
     _valueProviderFactories       = optionsAccessor.Options.ValueProviderFactories.ToArray();
     _actionBindingContextAccessor = actionBindingContextAccessor;
     _maxModelValidationErrors     = optionsAccessor.Options.MaxModelValidationErrors;
     _logger   = loggerFactory.CreateLogger <ControllerActionInvoker>();
     _notifier = notifier;
 }
 public ControllerActionInvokerProvider(
     IControllerFactory controllerFactory,
     IEnumerable<IFilterProvider> filterProviders,
     IControllerActionArgumentBinder argumentBinder,
     IOptions<MvcOptions> optionsAccessor,
     IActionBindingContextAccessor actionBindingContextAccessor,
     ILoggerFactory loggerFactory,
     INotifier notifier)
 {
     _controllerFactory = controllerFactory;
     _filterProviders = filterProviders.OrderBy(item => item.Order).ToArray();
     _argumentBinder = argumentBinder;
     _inputFormatters = optionsAccessor.Options.InputFormatters.ToArray();
     _outputFormatters = optionsAccessor.Options.OutputFormatters.ToArray();
     _modelBinders = optionsAccessor.Options.ModelBinders.ToArray();
     _modelValidatorProviders = optionsAccessor.Options.ModelValidatorProviders.ToArray();
     _valueProviderFactories = optionsAccessor.Options.ValueProviderFactories.ToArray();
     _actionBindingContextAccessor = actionBindingContextAccessor;
     _maxModelValidationErrors = optionsAccessor.Options.MaxModelValidationErrors;
     _logger = loggerFactory.CreateLogger<ControllerActionInvoker>();
     _notifier = notifier;
 }
Exemple #14
0
        public FilterActionInvoker(
            ActionContext actionContext,
            IReadOnlyList <IFilterProvider> filterProviders,
            IReadOnlyList <IInputFormatter> inputFormatters,
            IReadOnlyList <IOutputFormatter> outputFormatters,
            IReadOnlyList <IModelBinder> modelBinders,
            IReadOnlyList <IModelValidatorProvider> modelValidatorProviders,
            IReadOnlyList <IValueProviderFactory> valueProviderFactories,
            IActionBindingContextAccessor actionBindingContextAccessor,
            ILogger logger,
            DiagnosticSource diagnosticSource,
            int maxModelValidationErrors)
        {
            if (actionContext == null)
            {
                throw new ArgumentNullException(nameof(actionContext));
            }

            if (filterProviders == null)
            {
                throw new ArgumentNullException(nameof(filterProviders));
            }

            if (inputFormatters == null)
            {
                throw new ArgumentNullException(nameof(inputFormatters));
            }

            if (outputFormatters == null)
            {
                throw new ArgumentNullException(nameof(outputFormatters));
            }

            if (modelBinders == null)
            {
                throw new ArgumentNullException(nameof(modelBinders));
            }

            if (modelValidatorProviders == null)
            {
                throw new ArgumentNullException(nameof(modelValidatorProviders));
            }

            if (valueProviderFactories == null)
            {
                throw new ArgumentNullException(nameof(valueProviderFactories));
            }

            if (actionBindingContextAccessor == null)
            {
                throw new ArgumentNullException(nameof(actionBindingContextAccessor));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (diagnosticSource == null)
            {
                throw new ArgumentNullException(nameof(diagnosticSource));
            }

            ActionContext = actionContext;

            _filterProviders              = filterProviders;
            _inputFormatters              = inputFormatters;
            _outputFormatters             = outputFormatters;
            _modelBinders                 = modelBinders;
            _modelValidatorProviders      = modelValidatorProviders;
            _valueProviderFactories       = valueProviderFactories;
            _actionBindingContextAccessor = actionBindingContextAccessor;
            Logger                    = logger;
            _diagnosticSource         = diagnosticSource;
            _maxModelValidationErrors = maxModelValidationErrors;
        }
        public ControllerActionInvoker(
            ActionContext actionContext,
            IReadOnlyList<IFilterProvider> filterProviders,
            IControllerFactory controllerFactory,
            ControllerActionDescriptor descriptor,
            IReadOnlyList<IInputFormatter> inputFormatters,
            IReadOnlyList<IOutputFormatter> outputFormatters,
            IControllerActionArgumentBinder controllerActionArgumentBinder,
            IReadOnlyList<IModelBinder> modelBinders,
            IReadOnlyList<IModelValidatorProvider> modelValidatorProviders,
            IReadOnlyList<IValueProviderFactory> valueProviderFactories,
            IActionBindingContextAccessor actionBindingContextAccessor,
            ILogger logger,
            DiagnosticSource diagnosticSource,
            int maxModelValidationErrors)
            : base(
                  actionContext,
                  filterProviders,
                  inputFormatters,
                  outputFormatters,
                  modelBinders,
                  modelValidatorProviders,
                  valueProviderFactories,
                  actionBindingContextAccessor,
                  logger,
                  diagnosticSource,
                  maxModelValidationErrors)
        {
            if (actionContext == null)
            {
                throw new ArgumentNullException(nameof(actionContext));
            }

            if (filterProviders == null)
            {
                throw new ArgumentNullException(nameof(filterProviders));
            }

            if (controllerFactory == null)
            {
                throw new ArgumentNullException(nameof(controllerFactory));
            }

            if (descriptor == null)
            {
                throw new ArgumentNullException(nameof(descriptor));
            }

            if (inputFormatters == null)
            {
                throw new ArgumentNullException(nameof(inputFormatters));
            }

            if (outputFormatters == null)
            {
                throw new ArgumentNullException(nameof(outputFormatters));
            }

            if (controllerActionArgumentBinder == null)
            {
                throw new ArgumentNullException(nameof(controllerActionArgumentBinder));
            }

            if (modelBinders == null)
            {
                throw new ArgumentNullException(nameof(modelBinders));
            }

            if (modelValidatorProviders == null)
            {
                throw new ArgumentNullException(nameof(modelValidatorProviders));
            }

            if (valueProviderFactories == null)
            {
                throw new ArgumentNullException(nameof(valueProviderFactories));
            }

            if (actionBindingContextAccessor == null)
            {
                throw new ArgumentNullException(nameof(actionBindingContextAccessor));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (diagnosticSource == null)
            {
                throw new ArgumentNullException(nameof(diagnosticSource));
            }

            _descriptor = descriptor;
            _controllerFactory = controllerFactory;
            _argumentBinder = controllerActionArgumentBinder;

            if (descriptor.MethodInfo == null)
            {
                throw new ArgumentException(
                    Resources.FormatPropertyOfTypeCannotBeNull("MethodInfo",
                                                               typeof(ControllerActionDescriptor)),
                    "descriptor");
            }
        }
Exemple #16
0
        public ControllerActionInvoker(
            ActionContext actionContext,
            IReadOnlyList <IFilterProvider> filterProviders,
            IControllerFactory controllerFactory,
            ControllerActionDescriptor descriptor,
            IReadOnlyList <IInputFormatter> inputFormatters,
            IReadOnlyList <IOutputFormatter> outputFormatters,
            IControllerActionArgumentBinder controllerActionArgumentBinder,
            IReadOnlyList <IModelBinder> modelBinders,
            IReadOnlyList <IModelValidatorProvider> modelValidatorProviders,
            IReadOnlyList <IValueProviderFactory> valueProviderFactories,
            IActionBindingContextAccessor actionBindingContextAccessor,
            ILogger logger,
            DiagnosticSource diagnosticSource,
            int maxModelValidationErrors)
            : base(
                actionContext,
                filterProviders,
                inputFormatters,
                outputFormatters,
                modelBinders,
                modelValidatorProviders,
                valueProviderFactories,
                actionBindingContextAccessor,
                logger,
                diagnosticSource,
                maxModelValidationErrors)
        {
            if (actionContext == null)
            {
                throw new ArgumentNullException(nameof(actionContext));
            }

            if (filterProviders == null)
            {
                throw new ArgumentNullException(nameof(filterProviders));
            }

            if (controllerFactory == null)
            {
                throw new ArgumentNullException(nameof(controllerFactory));
            }

            if (descriptor == null)
            {
                throw new ArgumentNullException(nameof(descriptor));
            }

            if (inputFormatters == null)
            {
                throw new ArgumentNullException(nameof(inputFormatters));
            }

            if (outputFormatters == null)
            {
                throw new ArgumentNullException(nameof(outputFormatters));
            }

            if (controllerActionArgumentBinder == null)
            {
                throw new ArgumentNullException(nameof(controllerActionArgumentBinder));
            }

            if (modelBinders == null)
            {
                throw new ArgumentNullException(nameof(modelBinders));
            }

            if (modelValidatorProviders == null)
            {
                throw new ArgumentNullException(nameof(modelValidatorProviders));
            }

            if (valueProviderFactories == null)
            {
                throw new ArgumentNullException(nameof(valueProviderFactories));
            }

            if (actionBindingContextAccessor == null)
            {
                throw new ArgumentNullException(nameof(actionBindingContextAccessor));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (diagnosticSource == null)
            {
                throw new ArgumentNullException(nameof(diagnosticSource));
            }

            _descriptor        = descriptor;
            _controllerFactory = controllerFactory;
            _argumentBinder    = controllerActionArgumentBinder;

            if (descriptor.MethodInfo == null)
            {
                throw new ArgumentException(
                          Resources.FormatPropertyOfTypeCannotBeNull("MethodInfo",
                                                                     typeof(ControllerActionDescriptor)),
                          "descriptor");
            }
        }
 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;
 }
 public TestObjectResultExecutor(
     IOptions<MvcOptions> options, 
     IActionBindingContextAccessor bindingContextAccessor,
     IHttpResponseStreamWriterFactory writerFactory,
     ILoggerFactory loggerFactory) 
     : base(options, bindingContextAccessor, writerFactory, loggerFactory)
 {
 }