Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ObjectGraphSanitizer"/> class.
 /// </summary>
 /// <param name="textSanitizer">The text sanitizer.</param>
 /// <param name="maxDegreeOfParallelism">The degree of parallelism to invoke sanitization.</param>
 public ObjectGraphSanitizer(ISanitizeText textSanitizer, Int32 maxDegreeOfParallelism)
 {
     _TextSanitizer   = textSanitizer;
     _ParallelOptions = new ParallelOptions {
         MaxDegreeOfParallelism = maxDegreeOfParallelism
     };
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpParameterBindingSanitizerFilter"/> class.
 /// </summary>
 /// <param name="textSanitizer">The text sanitizer.</param>
 /// <param name="maxDegreeOfParallelism">The max degree of parallelism to invoke sanitization.</param>
 /// <param name="filterMethods">The filter methods.</param>
 public HttpParameterBindingSanitizerFilter(ISanitizeText textSanitizer, Int32 maxDegreeOfParallelism, params HttpMethod[] filterMethods)
 {
     _TextSanitizer          = textSanitizer;
     _MaxDegreeOfParallelism = maxDegreeOfParallelism <= 0 ? Environment.ProcessorCount : maxDegreeOfParallelism;
     _FilterMethods          = filterMethods == null || !filterMethods.Any() ? new[] { HttpMethod.Post, HttpMethod.Put, new HttpMethod("PATCH") } : filterMethods;
     _ObjectGraphSanitizer   = new Lazy <ObjectGraphSanitizer>(() => new ObjectGraphSanitizer(_TextSanitizer, _MaxDegreeOfParallelism));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpParameterBindingSanitizerFilter"/> class.
 /// </summary>
 /// <param name="textSanitizer">The text sanitizer.</param>
 /// <param name="maxDegreeOfParallelism">The max degree of parallelism to invoke sanitization.</param>
 /// <param name="filterMethods">The filter methods.</param>
 public HttpParameterBindingSanitizerFilter(ISanitizeText textSanitizer, Int32 maxDegreeOfParallelism, params HttpMethod[] filterMethods)
 {
     _TextSanitizer = textSanitizer;
     _MaxDegreeOfParallelism = maxDegreeOfParallelism <= 0 ? Environment.ProcessorCount : maxDegreeOfParallelism;
     _FilterMethods = filterMethods == null || !filterMethods.Any() ? new[] { HttpMethod.Post, HttpMethod.Put, new HttpMethod("PATCH") } : filterMethods;
     _ObjectGraphSanitizer = new Lazy<ObjectGraphSanitizer>(() => new ObjectGraphSanitizer(_TextSanitizer, _MaxDegreeOfParallelism));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpParameterBindingSanitizerFilter"/> class.
 /// </summary>
 /// <param name="textSanitizer">The text sanitizer.</param>
 /// <param name="filterMethods">The filter methods.</param>
 public HttpParameterBindingSanitizerFilter(ISanitizeText textSanitizer, params HttpMethod[] filterMethods)
     : this(textSanitizer, Environment.ProcessorCount, filterMethods)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpParameterBindingSanitizerFilter"/> class.
 /// </summary>
 /// <param name="textSanitizer">The text sanitizer.</param>
 /// <param name="filterMethods">The filter methods.</param>
 public HttpParameterBindingSanitizerFilter(ISanitizeText textSanitizer, params HttpMethod[] filterMethods)
     : this(textSanitizer, Environment.ProcessorCount, filterMethods)
 {}