示例#1
0
 /// <summary>
 /// Overrides the default implementation of JSON parsing and formatting to use Newtonsoft.JSON
 /// instead with the given <see cref="JsonSerializerSettings" />.
 /// </summary>
 /// <param name="builder">The builder to configure.</param>
 /// <param name="settings">The settings to use.</param>
 public static void UseNewtonsoft(this BlueprintHttpBuilder builder, JsonSerializerSettings settings)
 {
     builder.Options(o =>
     {
         // Inserting these at the start will ensure they are selected first, before the default
         // SystemTextJson implementations.
         o.BodyParsers.Insert(0, new NewtonsoftJsonBodyParser(settings));
         o.OutputFormatters.Insert(0, new NewtonsoftJsonResultOutputFormatter(settings));
     });
 }
示例#2
0
 /// <summary>
 /// Overrides the default implementation of JSON parsing and formatting to use Newtonsoft.JSON
 /// instead, using default serializer settings.
 /// </summary>
 /// <param name="builder">The builder to configure.</param>
 public static void UseNewtonsoft(this BlueprintHttpBuilder builder)
 {
     builder.UseNewtonsoft(NewtonsoftJsonResultOutputFormatter.CreateSettings());
 }