Skip to content
代码片段 群组 项目
未验证 提交 7e6674c1 编辑于 作者: Safia Abdalla's avatar Safia Abdalla 提交者: GitHub
浏览文件

Add ConfigureRouteHandlerJsonOptions for M.A.Htt.Json.JsonOptions (#39502)

* Add ConfigureHttpJsonOptions for M.A.Htt.Json.JsonOptions

* Address initial feedback from API review

* Fix method reference in doc comment

* Fix up crefs
上级 85ac505b
No related branches found
No related tags found
无相关合并请求
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Microsoft.AspNetCore.Http.Json;
namespace Microsoft.Extensions.DependencyInjection;
/// <summary>
/// Extension methods to configure JSON serialization behavior.
/// </summary>
public static class RouteHandlerJsonServiceExtensions
{
/// <summary>
/// Configures options used for reading and writing JSON by route handlers.
/// </summary>
/// <remarks>
/// The options configured here will only affect JSON returned and processed
/// from route handlers, not controllers, when using <see cref="O:Microsoft.AspNetCore.Http.HttpRequestJsonExtensions.ReadFromJsonAsync" />
/// and <see cref="O:Microsoft.AspNetCore.Http.HttpResponseJsonExtensions.WriteAsJsonAsync" />.
/// </remarks>
/// <param name="services">The <see cref="IServiceCollection" /> to configure options on.</param>
/// <param name="configureOptions">The <see cref="Action{JsonOptions}"/> to configure the
/// <see cref="JsonOptions"/>.</param>
/// <returns>The modified <see cref="IServiceCollection"/>.</returns>
public static IServiceCollection ConfigureRouteHandlerJsonOptions(this IServiceCollection services, Action<JsonOptions> configureOptions)
{
services.Configure<JsonOptions>(configureOptions);
return services;
}
}
#nullable enable #nullable enable
Microsoft.Extensions.DependencyInjection.RouteHandlerJsonServiceExtensions
static Microsoft.Extensions.DependencyInjection.RouteHandlerJsonServiceExtensions.ConfigureRouteHandlerJsonOptions(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services, System.Action<Microsoft.AspNetCore.Http.Json.JsonOptions!>! configureOptions) -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册