/// <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); }
/// <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); }
/// <summary> /// Initializes a new instance of the <see cref="PartialJsonOutputFormatter"/> class. /// </summary> /// <param name="serializerSettings"> /// The <see cref="JsonSerializerSettings"/>. Should be either the application-wide settings /// (<see cref="MvcPartialJsonOptions.SerializerSettings"/>) or an instance /// <see cref="JsonSerializerSettingsProvider.CreateSerializerSettings"/> initially returned. /// </param> /// <param name="fieldsParser">The <see cref="IFieldsParser"/>.</param> /// <param name="charPool">The <see cref="ArrayPool{Char}"/>.</param> /// <param name="options">The <see cref="MvcPartialJsonOptions"/>.</param> public PartialJsonOutputFormatter(JsonSerializerSettings serializerSettings, IFieldsParser fieldsParser, ArrayPool <char> charPool, MvcPartialJsonOptions options) { if (serializerSettings == null) { throw new ArgumentNullException(nameof(serializerSettings)); } if (fieldsParser == null) { throw new ArgumentNullException(nameof(fieldsParser)); } if (charPool == null) { throw new ArgumentNullException(nameof(charPool)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } this.SerializerSettings = serializerSettings; this.fieldsParser = fieldsParser; this.charPool = new JsonArrayPool <char>(charPool); this.options = options; this.SupportedEncodings.Add(Encoding.UTF8); this.SupportedEncodings.Add(Encoding.Unicode); this.SupportedMediaTypes.Add(MediaTypeHeaderValues.ApplicationJson); this.SupportedMediaTypes.Add(MediaTypeHeaderValues.ApplicationWildcardJson); this.SupportedMediaTypes.Add(MediaTypeHeaderValues.TextJson); }
public QueryParser(IWebFilterConverter <TEntity> webFilterConverter, IPagingParser pagingParser, IFilterParser filterParser, IFieldsParser fieldsParser, IOrderByParser orderByParser, ITypeFilterParser <TEntity> typeFilterParser) { _webFilterConverter = webFilterConverter ?? throw new ArgumentNullException(nameof(webFilterConverter)); _pagingParser = pagingParser ?? throw new ArgumentNullException(nameof(pagingParser)); _filterParser = filterParser ?? throw new ArgumentNullException(nameof(filterParser)); _fieldsParser = fieldsParser ?? throw new ArgumentNullException(nameof(fieldsParser)); _orderByParser = orderByParser ?? throw new ArgumentNullException(nameof(orderByParser)); _typeFilterParser = typeFilterParser ?? throw new ArgumentNullException(nameof(typeFilterParser)); }
/// <summary> /// Initializes a new instance of the <see cref="MvcPartialJsonMvcOptionsSetup"/> class. /// </summary> /// <param name="fieldsParser">The fields parser.</param> /// <param name="partialJsonOptions">The options.</param> /// <param name="charPool">The character array pool.</param> public MvcPartialJsonMvcOptionsSetup(IFieldsParser fieldsParser, IOptions <MvcPartialJsonOptions> partialJsonOptions, ArrayPool <char> charPool) { if (fieldsParser == null) { throw new ArgumentNullException(nameof(fieldsParser)); } if (partialJsonOptions == null) { throw new ArgumentNullException(nameof(partialJsonOptions)); } if (charPool == null) { throw new ArgumentNullException(nameof(charPool)); } this.fieldsParser = fieldsParser; this.partialJsonOptions = partialJsonOptions.Value; this.charPool = charPool; }
public BaseClassSerializer(ISerializerProvider serializerProvider, IFieldsParser fieldsParser, NamingStrategy namingStrategy, IUrlProvider urlProvider) : base(serializerProvider, namingStrategy, urlProvider) { _fieldsParser = fieldsParser; }