Esempio n. 1
0
        /// <summary>
        /// Creates a new <see cref="ViewExecutor"/>.
        /// </summary>
        /// <param name="viewOptions">The <see cref="IOptions{MvcViewOptions}"/>.</param>
        /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
        /// <param name="viewEngine">The <see cref="ICompositeViewEngine"/>.</param>
        /// <param name="diagnosticSource">The <see cref="DiagnosticSource"/>.</param>
        public ViewExecutor(
            IOptions<MvcViewOptions> viewOptions,
            IHttpResponseStreamWriterFactory writerFactory,
            ICompositeViewEngine viewEngine,
            DiagnosticSource diagnosticSource)
        {
            if (viewOptions == null)
            {
                throw new ArgumentNullException(nameof(viewOptions));
            }

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

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

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

            ViewOptions = viewOptions.Value;
            WriterFactory = writerFactory;
            ViewEngine = viewEngine;
            DiagnosticSource = diagnosticSource;
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new <see cref="JsonResultExecutor"/>.
        /// </summary>
        /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
        /// <param name="logger">The <see cref="ILogger{JsonResultExecutor}"/>.</param>
        /// <param name="options">The <see cref="IOptions{MvcJsonOptions}"/>.</param>
        /// <param name="charPool">The <see cref="ArrayPool{Char}"/> for creating <see cref="T:char[]"/> buffers.</param>
        public JsonResultExecutor(
            IHttpResponseStreamWriterFactory writerFactory,
            ILogger<JsonResultExecutor> logger,
            IOptions<MvcJsonOptions> options,
            ArrayPool<char> charPool)
        {
            if (writerFactory == null)
            {
                throw new ArgumentNullException(nameof(writerFactory));
            }

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

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

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

            WriterFactory = writerFactory;
            Logger = logger;
            Options = options.Value;
            _charPool = new JsonArrayPool<char>(charPool);
        }
Esempio n. 3
0
 public CustomObjectResultExecutor(
     IOptions <MvcOptions> options,
     IHttpResponseStreamWriterFactory writerFactory,
     ILoggerFactory loggerFactory)
     : base(options, writerFactory, loggerFactory)
 {
 }
Esempio n. 4
0
        /// <summary>
        /// Creates a new <see cref="JsonResultExecutor"/>.
        /// </summary>
        /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
        /// <param name="logger">The <see cref="ILogger{JsonResultExecutor}"/>.</param>
        /// <param name="options">The <see cref="IOptions{MvcJsonOptions}"/>.</param>
        /// <param name="charPool">The <see cref="ArrayPool{Char}"/> for creating <see cref="T:char[]"/> buffers.</param>
        public JsonpResultExecutor(
            IHttpResponseStreamWriterFactory writerFactory,
            ILogger <JsonResultExecutor> logger,
            IOptions <MvcJsonOptions> options,
            ArrayPool <char> charPool)
        {
            if (writerFactory == null)
            {
                throw new ArgumentNullException(nameof(writerFactory));
            }

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

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

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

            WriterFactory = writerFactory;
            Logger        = logger;
            Options       = options.Value;
            _charPool     = new JsonArrayPool <char>(charPool);
        }
Esempio n. 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PartialJsonResultExecutor"/> class.
        /// </summary>
        /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
        /// <param name="logger">The <see cref="ILogger{PartialJsonResultExecutor}"/>.</param>
        /// <param name="mvcOptions">Accessor to <see cref="MvcOptions"/>.</param>
        /// <param name="jsonOptions">Accessor to <see cref="MvcPartialJsonOptions"/>.</param>
        /// <param name="fieldsParser">The <see cref="IFieldsParser"/>.</param>
        /// <param name="charPool">The <see cref="ArrayPool{Char}"/> for creating <see cref="T:char[]"/> buffers.</param>
        public PartialJsonResultExecutor(IHttpResponseStreamWriterFactory writerFactory, ILogger <PartialJsonResultExecutor> logger, IOptions <MvcOptions> mvcOptions, IOptions <MvcPartialJsonOptions> jsonOptions, IFieldsParser fieldsParser, ArrayPool <char> charPool)
        {
            if (writerFactory == null)
            {
                throw new ArgumentNullException(nameof(writerFactory));
            }

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

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

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

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

            this.writerFactory         = writerFactory;
            this.logger                = logger;
            this.mvcOptions            = mvcOptions?.Value ?? throw new ArgumentNullException(nameof(mvcOptions));
            this.jsonOptions           = jsonOptions.Value;
            this.fieldsParser          = fieldsParser;
            this.charPool              = new JsonArrayPool <char>(charPool);
            this.asyncEnumerableReader = new AsyncEnumerableReader(this.mvcOptions);
        }
Esempio n. 6
0
        /// <summary>
        /// Creates a new <see cref="ViewExecutor"/>.
        /// </summary>
        /// <param name="viewOptions">The <see cref="IOptions{MvcViewOptions}"/>.</param>
        /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
        /// <param name="viewEngine">The <see cref="ICompositeViewEngine"/>.</param>
        /// <param name="tempDataFactory">The <see cref="ITempDataDictionaryFactory"/>.</param>
        /// <param name="diagnosticListener">The <see cref="DiagnosticListener"/>.</param>
        /// <param name="modelMetadataProvider">The <see cref="IModelMetadataProvider" />.</param>
        public ViewExecutor(
            IOptions <MvcViewOptions> viewOptions,
            IHttpResponseStreamWriterFactory writerFactory,
            ICompositeViewEngine viewEngine,
            ITempDataDictionaryFactory tempDataFactory,
            DiagnosticListener diagnosticListener,
            IModelMetadataProvider modelMetadataProvider)
            : this(writerFactory, viewEngine, diagnosticListener)
        {
            if (viewOptions == null)
            {
                throw new ArgumentNullException(nameof(viewOptions));
            }

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

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

            ViewOptions           = viewOptions.Value;
            TempDataFactory       = tempDataFactory;
            ModelMetadataProvider = modelMetadataProvider;
        }
Esempio n. 7
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;
        }
        /// <summary>
        /// Creates a new <see cref="NewtonsoftJsonResultExecutor"/>.
        /// </summary>
        /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
        /// <param name="logger">The <see cref="ILogger{NewtonsoftJsonResultExecutor}"/>.</param>
        /// <param name="mvcOptions">Accessor to <see cref="MvcOptions"/>.</param>
        /// <param name="jsonOptions">Accessor to <see cref="MvcNewtonsoftJsonOptions"/>.</param>
        /// <param name="charPool">The <see cref="ArrayPool{Char}"/> for creating <see cref="T:char[]"/> buffers.</param>
        public NewtonsoftJsonResultExecutor(
            IHttpResponseStreamWriterFactory writerFactory,
            ILogger <NewtonsoftJsonResultExecutor> logger,
            IOptions <MvcOptions> mvcOptions,
            IOptions <MvcNewtonsoftJsonOptions> jsonOptions,
            ArrayPool <char> charPool)
        {
            if (writerFactory == null)
            {
                throw new ArgumentNullException(nameof(writerFactory));
            }

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

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

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

            _writerFactory = writerFactory;
            _logger        = logger;
            _mvcOptions    = mvcOptions?.Value ?? throw new ArgumentNullException(nameof(mvcOptions));
            _jsonOptions   = jsonOptions.Value;
            _charPool      = new JsonArrayPool <char>(charPool);
            _asyncEnumerableReaderFactory = new AsyncEnumerableReader(_mvcOptions);
        }
Esempio n. 9
0
        /// <summary>
        /// Creates a new <see cref="ViewExecutor"/>.
        /// </summary>
        /// <param name="viewOptions">The <see cref="IOptions{MvcViewOptions}"/>.</param>
        /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
        /// <param name="viewEngine">The <see cref="ICompositeViewEngine"/>.</param>
        /// <param name="diagnosticSource">The <see cref="DiagnosticSource"/>.</param>
        public ViewExecutor(
            IOptions <MvcViewOptions> viewOptions,
            IHttpResponseStreamWriterFactory writerFactory,
            ICompositeViewEngine viewEngine,
            DiagnosticSource diagnosticSource)
        {
            if (viewOptions == null)
            {
                throw new ArgumentNullException(nameof(viewOptions));
            }

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

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

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

            ViewOptions      = viewOptions.Value;
            WriterFactory    = writerFactory;
            ViewEngine       = viewEngine;
            DiagnosticSource = diagnosticSource;
        }
Esempio n. 10
0
    /// <summary>
    /// Creates a new <see cref="ObjectResultExecutor"/>.
    /// </summary>
    /// <param name="formatterSelector">The <see cref="OutputFormatterSelector"/>.</param>
    /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
    /// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
    /// <param name="mvcOptions">Accessor to <see cref="MvcOptions"/>.</param>
    public ObjectResultExecutor(
        OutputFormatterSelector formatterSelector,
        IHttpResponseStreamWriterFactory writerFactory,
        ILoggerFactory loggerFactory,
        IOptions <MvcOptions> mvcOptions)
    {
        if (formatterSelector == null)
        {
            throw new ArgumentNullException(nameof(formatterSelector));
        }

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

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

        FormatterSelector = formatterSelector;
        WriterFactory     = writerFactory.CreateWriter;
        Logger            = loggerFactory.CreateLogger <ObjectResultExecutor>();
    }
        /// <summary>
        /// Initializes a new instance of the <see cref="PartialJsonResultExecutor"/> class.
        /// </summary>
        /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
        /// <param name="logger">The <see cref="ILogger{PartialJsonResultExecutor}"/>.</param>
        /// <param name="options">The <see cref="IOptions{MvcPartialJsonOptions}"/>.</param>
        /// <param name="fieldsParser">The <see cref="fieldsParser"/>.</param>
        /// <param name="charPool">The <see cref="ArrayPool{Char}"/> for creating <see cref="T:char[]"/> buffers.</param>
        public PartialJsonResultExecutor(IHttpResponseStreamWriterFactory writerFactory, ILogger <PartialJsonResultExecutor> logger, IOptions <MvcPartialJsonOptions> options, IFieldsParser fieldsParser, ArrayPool <char> charPool)
        {
            if (writerFactory == null)
            {
                throw new ArgumentNullException(nameof(writerFactory));
            }

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

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

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

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

            this.WriterFactory = writerFactory;
            this.Logger        = logger;
            this.Options       = options.Value;
            this.fieldsParser  = fieldsParser;
            this.charPool      = new JsonArrayPool <char>(charPool);
        }
Esempio n. 12
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;
        }
 public ObjectResultExecutor(
     OutputFormatterSelector formatterSelector,
     IHttpResponseStreamWriterFactory writerFactory,
     ILoggerFactory loggerFactory)
     : this(formatterSelector, writerFactory, loggerFactory, mvcOptions : null)
 {
 }
        /// <summary>
        /// Creates a new <see cref="ObjectResultExecutor"/>.
        /// </summary>
        /// <param name="formatterSelector">The <see cref="OutputFormatterSelector"/>.</param>
        /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
        /// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
        /// <param name="mvcOptions">Accessor to <see cref="MvcOptions"/>.</param>
        public ObjectResultExecutor(
            OutputFormatterSelector formatterSelector,
            IHttpResponseStreamWriterFactory writerFactory,
            ILoggerFactory loggerFactory,
            IOptions <MvcOptions> mvcOptions)
        {
            if (formatterSelector == null)
            {
                throw new ArgumentNullException(nameof(formatterSelector));
            }

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

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

            FormatterSelector = formatterSelector;
            WriterFactory     = writerFactory.CreateWriter;
            Logger            = loggerFactory.CreateLogger <ObjectResultExecutor>();
            var options = mvcOptions?.Value ?? throw new ArgumentNullException(nameof(mvcOptions));

            _asyncEnumerableReaderFactory = new AsyncEnumerableReader(options);
        }
Esempio n. 15
0
        public async Task Invoke(HttpContext context, IHttpResponseStreamWriterFactory writerFactory)
        {
            await _next(context);

            if (context.Response.IsSuccessStatusCode())
            {
                return;
            }


            var result = new OperationOutcomeResultContext(HttpStatusCode.InternalServerError, OperationOutcomeExtensions.GetOperationOutcome().AddError("Внутренняя ошибка сервера"));

            var exceptionHandlerFeature = context.Features.Get <IExceptionHandlerFeature>();

            if (exceptionHandlerFeature != null)
            {
                result = _httpStatusToOperationOutcomeMiddlewareOptions.GetExceptionHandler(exceptionHandlerFeature.Error)?
                         .Invoke(exceptionHandlerFeature.Error) ?? result;
            }


            result = _httpStatusToOperationOutcomeMiddlewareOptions.GetStatusHandler((HttpStatusCode)context.Response.StatusCode)?
                     .Invoke((HttpStatusCode)context.Response.StatusCode) ?? result;



            var outputFormatter = (context.Features.Get <IOutputFormatter>() ?? _options.OutputFormatters.First());

            await result.ExecuteResultAsync(context, outputFormatter, writerFactory);
        }
Esempio n. 16
0
 public MiruObjectResultExecutor(
     OutputFormatterSelector formatterSelector,
     IHttpResponseStreamWriterFactory writerFactory,
     ILoggerFactory loggerFactory,
     IOptions <MvcOptions> mvcOptions) :
     base(formatterSelector, writerFactory, loggerFactory, mvcOptions)
 {
 }
Esempio n. 17
0
 public TestObjectResultExecutor(
     IOptions <MvcOptions> options,
     IActionBindingContextAccessor bindingContextAccessor,
     IHttpResponseStreamWriterFactory writerFactory,
     ILoggerFactory loggerFactory)
     : base(options, bindingContextAccessor, writerFactory, loggerFactory)
 {
 }
Esempio n. 18
0
 public JsonResultExecutor(IHttpResponseStreamWriterFactory writerFactory,
                           ILogger <JsonResultExecutor> logger,
                           IOptions <MvcJsonOptions> jsonOptions,
                           IOptions <MvcOptions> mvcOptions,
                           ArrayPool <char> charPool)
     : base(writerFactory, logger, jsonOptions, charPool)
 {
     this.mvcOptions = mvcOptions.Value;
 }
 public EmailViewResultExecutor(ILoggerFactory loggerFactory,
                                IHttpResponseStreamWriterFactory httpResponseStreamWriterFactory,
                                IEmailViewRender render,
                                IEmailParser parser = null)
 {
     _logger = loggerFactory.CreateLogger <EmailViewResultExecutor>();
     _httpResponseStreamWriterFactory = httpResponseStreamWriterFactory;
     Render = render;
     Parser = parser ?? new EmailParser(Render);
 }
        public NdjsonTextWriterFactory(IHttpResponseStreamWriterFactory httpResponseStreamWriterFactory, IOptions <MvcJsonOptions> options, ArrayPool <char> innerJsonArrayPool)
        {
            _httpResponseStreamWriterFactory = httpResponseStreamWriterFactory ?? throw new ArgumentNullException(nameof(httpResponseStreamWriterFactory));
            _options = options?.Value ?? throw new ArgumentNullException(nameof(options));

            if (innerJsonArrayPool == null)
            {
                throw new ArgumentNullException(nameof(innerJsonArrayPool));
            }
            _jsonArrayPool = new JsonArrayPool <char>(innerJsonArrayPool);
        }
 public PageResultExecutor(
     IHttpResponseStreamWriterFactory writerFactory,
     IRazorViewEngine razorViewEngine,
     IRazorPageActivator razorPageActivator,
     HtmlEncoder htmlEncoder)
 {
     WriterFactory       = writerFactory;
     _razorViewEngine    = razorViewEngine;
     _razorPageActivator = razorPageActivator;
     _htmlEncoder        = htmlEncoder;
 }
Esempio n. 22
0
 public ViewResultExecutor(
     IOptions <MvcViewOptions> viewOptions,
     IHttpResponseStreamWriterFactory writerFactory,
     ICompositeViewEngine viewEngine,
     ITempDataDictionaryFactory tempDataFactory,
     DiagnosticSource diagnosticSource,
     ILoggerFactory loggerFactory,
     IModelMetadataProvider modelMetadataProvider)
     : base(viewOptions, writerFactory, viewEngine, tempDataFactory, diagnosticSource, loggerFactory, modelMetadataProvider)
 {
 }
Esempio n. 23
0
 public DomainExceptionFilter(
     ILoggerFactory loggerFactory,
     IOptions <DomainOptions> domainOptions,
     IOptions <MvcOptions> mvcOptions,
     IHttpResponseStreamWriterFactory writerFactory)
 {
     this.logger            = loggerFactory.CreateLogger <DomainExceptionFilter>();
     this.options           = domainOptions;
     this.optionsFormatters = mvcOptions.Value.OutputFormatters;
     this.writerFactory     = writerFactory.CreateWriter;
 }
 public CultureMatchingViewResultExecutor(
     IHostingEnvironment env,
     IOptions <MvcViewOptions> viewOptions,
     IHttpResponseStreamWriterFactory writerFactory,
     ICompositeViewEngine viewEngine,
     ITempDataDictionaryFactory tempDataFactory,
     DiagnosticSource diagnosticSource,
     ILoggerFactory loggerFactory,
     IModelMetadataProvider modelMetadataProvider) : base(viewOptions, writerFactory, viewEngine, tempDataFactory, diagnosticSource, loggerFactory, modelMetadataProvider)
 {
     this.env = env;
 }
Esempio n. 25
0
 /// <summary>
 /// Creates a new <see cref="PageResultExecutor"/>.
 /// </summary>
 /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
 /// <param name="compositeViewEngine">The <see cref="ICompositeViewEngine"/>.</param>
 /// <param name="razorViewEngine">The <see cref="IRazorViewEngine"/>.</param>
 /// <param name="razorPageActivator">The <see cref="IRazorPageActivator"/>.</param>
 /// <param name="diagnosticSource">The <see cref="DiagnosticSource"/>.</param>
 /// <param name="htmlEncoder">The <see cref="HtmlEncoder"/>.</param>
 public PageResultExecutor(
     IHttpResponseStreamWriterFactory writerFactory,
     ICompositeViewEngine compositeViewEngine,
     IRazorViewEngine razorViewEngine,
     IRazorPageActivator razorPageActivator,
     DiagnosticSource diagnosticSource,
     HtmlEncoder htmlEncoder)
     : base(writerFactory, compositeViewEngine, diagnosticSource)
 {
     _razorViewEngine    = razorViewEngine;
     _htmlEncoder        = htmlEncoder;
     _razorPageActivator = razorPageActivator;
     _diagnosticSource   = diagnosticSource;
 }
 public FormattingService(
     IActionContextAccessor actionContextAccessor,
     IOptions <MvcViewOptions> viewOptions,
     IHttpResponseStreamWriterFactory writerFactory,
     ICompositeViewEngine viewEngine,
     ITempDataDictionaryFactory tempDataFactory,
     DiagnosticSource diagnosticSource,
     IModelMetadataProvider modelMetadataProvider,
     ITempDataProvider tempDataProvider)
     : base(viewOptions, writerFactory, viewEngine, tempDataFactory, diagnosticSource, modelMetadataProvider)
 {
     _ActionContextAccessor = actionContextAccessor;
     _TempDataProvider      = tempDataProvider;
 }
Esempio n. 27
0
 public HtmlViewToStringRendererService(
     IActionContextAccessor actionContextAccessor,
     IOptions <MvcViewOptions> viewOptions,
     IHttpResponseStreamWriterFactory writerFactory,
     ICompositeViewEngine viewEngine,
     ITempDataDictionaryFactory tempDataFactory,
     DiagnosticListener diagnosticSource,
     IModelMetadataProvider modelMetadataProvider,
     ITempDataProvider tempDataProvider)
     : base(viewOptions, writerFactory, viewEngine, tempDataFactory, diagnosticSource, modelMetadataProvider)
 {
     this.actionContextAccessor = actionContextAccessor;
     this.tempDataProvider      = tempDataProvider;
 }
Esempio n. 28
0
        /// <summary>
        /// Creates a new <see cref="ViewResultExecutor"/>.
        /// </summary>
        /// <param name="viewOptions">The <see cref="IOptions{MvcViewOptions}"/>.</param>
        /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
        /// <param name="viewEngine">The <see cref="ICompositeViewEngine"/>.</param>
        /// <param name="diagnosticSource">The <see cref="DiagnosticSource"/>.</param>
        /// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
        public ViewResultExecutor(
            IOptions <MvcViewOptions> viewOptions,
            IHttpResponseStreamWriterFactory writerFactory,
            ICompositeViewEngine viewEngine,
            DiagnosticSource diagnosticSource,
            ILoggerFactory loggerFactory)
            : base(viewOptions, writerFactory, viewEngine, diagnosticSource)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            Logger = loggerFactory.CreateLogger <ViewResultExecutor>();
        }
        /// <summary>
        /// Creates a new <see cref="PartialViewResultExecutor"/>.
        /// </summary>
        /// <param name="viewOptions">The <see cref="IOptions{MvcViewOptions}"/>.</param>
        /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
        /// <param name="viewEngine">The <see cref="ICompositeViewEngine"/>.</param>
        /// <param name="diagnosticSource">The <see cref="DiagnosticSource"/>.</param>
        /// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
        public PartialViewResultExecutor(
            IOptions<MvcViewOptions> viewOptions,
            IHttpResponseStreamWriterFactory writerFactory,
            ICompositeViewEngine viewEngine,
            DiagnosticSource diagnosticSource,
            ILoggerFactory loggerFactory)
            : base(viewOptions, writerFactory, viewEngine, diagnosticSource)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            Logger = loggerFactory.CreateLogger<PartialViewResultExecutor>();
        }
 /// <summary>
 /// Creates an <see cref="HtmlResultExecutor"/>
 /// </summary>
 /// <param name="logger">The logger</param>
 /// <param name="writerFactory">The writer factory</param>
 public HtmlResultExecutor(
     ILogger <HtmlResultExecutor> logger,
     IHttpResponseStreamWriterFactory writerFactory
     )
 {
     if (logger == null)
     {
         throw new ArgumentNullException(nameof(logger));
     }
     if (writerFactory == null)
     {
         throw new ArgumentNullException(nameof(writerFactory));
     }
     _logger        = logger;
     _writerFactory = writerFactory;
 }
 /// <summary>
 /// Creates a <see cref="HtmlBuilderRendererResultExecutor{TModel}"/>
 /// </summary>
 /// <param name="loggerFactory">The logger factory</param>
 /// <param name="writerFactory">The writer factory</param>
 public HtmlBuilderRendererResultExecutor(
     ILoggerFactory loggerFactory,
     IHttpResponseStreamWriterFactory writerFactory
     )
 {
     if (loggerFactory == null)
     {
         throw new ArgumentNullException(nameof(loggerFactory));
     }
     if (writerFactory == null)
     {
         throw new ArgumentNullException(nameof(writerFactory));
     }
     _logger        = loggerFactory.CreateLogger(typeof(HtmlRendererResultExecutor <>));
     _writerFactory = writerFactory;
 }
        /// <summary>
        /// Creates a new <see cref="PartialViewResultExecutor"/>.
        /// </summary>
        /// <param name="viewOptions">The <see cref="IOptions{MvcViewOptions}"/>.</param>
        /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
        /// <param name="viewEngine">The <see cref="ICompositeViewEngine"/>.</param>
        /// <param name="tempDataFactory">The <see cref="ITempDataDictionaryFactory"/>.</param>
        /// <param name="diagnosticListener">The <see cref="DiagnosticListener"/>.</param>
        /// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
        /// <param name="modelMetadataProvider">The <see cref="IModelMetadataProvider"/>.</param>
        public PartialViewResultExecutor(
            IOptions <MvcViewOptions> viewOptions,
            IHttpResponseStreamWriterFactory writerFactory,
            ICompositeViewEngine viewEngine,
            ITempDataDictionaryFactory tempDataFactory,
            DiagnosticListener diagnosticListener,
            ILoggerFactory loggerFactory,
            IModelMetadataProvider modelMetadataProvider)
            : base(viewOptions, writerFactory, viewEngine, tempDataFactory, diagnosticListener, modelMetadataProvider)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            Logger = loggerFactory.CreateLogger <PartialViewResultExecutor>();
        }
Esempio n. 33
0
        /// <summary>
        /// Creates a new <see cref="ViewResultExecutor"/>.
        /// </summary>
        /// <param name="viewOptions">The <see cref="IOptions{MvcViewOptions}"/>.</param>
        /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
        /// <param name="viewEngine">The <see cref="ICompositeViewEngine"/>.</param>
        /// <param name="tempDataFactory">The <see cref="ITempDataDictionaryFactory"/>.</param>
        /// <param name="diagnosticSource">The <see cref="DiagnosticSource"/>.</param>
        /// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
        /// <param name="modelMetadataProvider">The <see cref="IModelMetadataProvider"/>.</param>
        public ViewResultExecutor(
            IOptions<MvcViewOptions> viewOptions,
            IHttpResponseStreamWriterFactory writerFactory,
            ICompositeViewEngine viewEngine,
            ITempDataDictionaryFactory tempDataFactory,
            DiagnosticSource diagnosticSource,
            ILoggerFactory loggerFactory,
            IModelMetadataProvider modelMetadataProvider)
            : base(viewOptions, writerFactory, viewEngine, tempDataFactory, diagnosticSource, modelMetadataProvider)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            Logger = loggerFactory.CreateLogger<ViewResultExecutor>();
        }
Esempio n. 34
0
        /// <summary>
        /// Creates a new <see cref="XmlResultExecutor"/>.
        /// </summary>
        /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
        /// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
        public XmlDcResultExecutor(
            IHttpResponseStreamWriterFactory writerFactory,
            ILoggerFactory loggerFactory)
        {
            if (writerFactory == null)
            {
                throw new ArgumentNullException(nameof(writerFactory));
            }

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

            WriterFactory = writerFactory;
            LoggerFactory = loggerFactory;
        }
Esempio n. 35
0
        /// <summary>
        /// Creates a new <see cref="ViewExecutor"/>.
        /// </summary>
        /// <param name="viewOptions">The <see cref="IOptions{MvcViewOptions}"/>.</param>
        /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
        /// <param name="viewEngine">The <see cref="ICompositeViewEngine"/>.</param>
        /// <param name="tempDataFactory">The <see cref="ITempDataDictionaryFactory"/>.</param>
        /// <param name="diagnosticSource">The <see cref="DiagnosticSource"/>.</param>
        /// <param name="modelMetadataProvider">The <see cref="IModelMetadataProvider" />.</param>
        public ViewExecutor(
            IOptions<MvcViewOptions> viewOptions,
            IHttpResponseStreamWriterFactory writerFactory,
            ICompositeViewEngine viewEngine,
            ITempDataDictionaryFactory tempDataFactory,
            DiagnosticSource diagnosticSource,
            IModelMetadataProvider modelMetadataProvider)
        {
            if (viewOptions == null)
            {
                throw new ArgumentNullException(nameof(viewOptions));
            }

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

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

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

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

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

            ViewOptions = viewOptions.Value;
            WriterFactory = writerFactory;
            ViewEngine = viewEngine;
            TempDataFactory = tempDataFactory;
            DiagnosticSource = diagnosticSource;
            _modelMetadataProvider = modelMetadataProvider;
        }
Esempio n. 36
0
        /// <summary>
        /// Creates a new <see cref="ViewExecutor"/>.
        /// </summary>
        /// <param name="viewOptions">The <see cref="IOptions{MvcViewOptions}"/>.</param>
        /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
        /// <param name="viewEngine">The <see cref="ICompositeViewEngine"/>.</param>
        /// <param name="tempDataFactory">The <see cref="ITempDataDictionaryFactory"/>.</param>
        /// <param name="diagnosticSource">The <see cref="DiagnosticSource"/>.</param>
        /// <param name="modelMetadataProvider">The <see cref="IModelMetadataProvider" />.</param>
        public ViewExecutor(
            IOptions <MvcViewOptions> viewOptions,
            IHttpResponseStreamWriterFactory writerFactory,
            ICompositeViewEngine viewEngine,
            ITempDataDictionaryFactory tempDataFactory,
            DiagnosticSource diagnosticSource,
            IModelMetadataProvider modelMetadataProvider)
        {
            if (viewOptions == null)
            {
                throw new ArgumentNullException(nameof(viewOptions));
            }

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

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

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

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

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

            ViewOptions            = viewOptions.Value;
            WriterFactory          = writerFactory;
            ViewEngine             = viewEngine;
            TempDataFactory        = tempDataFactory;
            DiagnosticSource       = diagnosticSource;
            _modelMetadataProvider = modelMetadataProvider;
        }
Esempio n. 37
0
        /// <summary>
        /// Creates a new <see cref="ObjectResultExecutor"/>.
        /// </summary>
        /// <param name="options">An accessor to <see cref="MvcOptions"/>.</param>
        /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
        /// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
        public ObjectResultExecutor(
            IOptions<MvcOptions> options,
            IHttpResponseStreamWriterFactory writerFactory,
            ILoggerFactory loggerFactory)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

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

            OptionsFormatters = options.Value.OutputFormatters;
            RespectBrowserAcceptHeader = options.Value.RespectBrowserAcceptHeader;
            ReturnHttpNotAcceptable = options.Value.ReturnHttpNotAcceptable;
            Logger = loggerFactory.CreateLogger<ObjectResultExecutor>();
            WriterFactory = writerFactory.CreateWriter;
        }
Esempio n. 38
0
 public TestObjectResultExecutor(
     IOptions<MvcOptions> options, 
     IActionBindingContextAccessor bindingContextAccessor,
     IHttpResponseStreamWriterFactory writerFactory,
     ILoggerFactory loggerFactory) 
     : base(options, bindingContextAccessor, writerFactory, loggerFactory)
 {
 }
Esempio n. 39
0
 public CustomObjectResultExecutor(
     IOptions<MvcOptions> options,
     IHttpResponseStreamWriterFactory writerFactory,
     ILoggerFactory loggerFactory)
     : base(options, writerFactory, loggerFactory)
 {
 }