OpenApiRouteHandlerBuilderExtensions.Produces 方法

定义

重载

Produces(RouteHandlerBuilder, Int32, Type, String, String[])

IProducesResponseTypeMetadataMetadata为 生成builder的所有终结点将 添加到 。

Produces<TResponse>(RouteHandlerBuilder, Int32, String, String[])

IProducesResponseTypeMetadataMetadata为 生成builder的所有终结点将 添加到 。

Produces(RouteHandlerBuilder, Int32, Type, String, String[])

IProducesResponseTypeMetadataMetadata为 生成builder的所有终结点将 添加到 。

public static Microsoft.AspNetCore.Builder.RouteHandlerBuilder Produces (this Microsoft.AspNetCore.Builder.RouteHandlerBuilder builder, int statusCode, Type? responseType = default, string? contentType = default, params string[] additionalContentTypes);
static member Produces : Microsoft.AspNetCore.Builder.RouteHandlerBuilder * int * Type * string * string[] -> Microsoft.AspNetCore.Builder.RouteHandlerBuilder
<Extension()>
Public Function Produces (builder As RouteHandlerBuilder, statusCode As Integer, Optional responseType As Type = Nothing, Optional contentType As String = Nothing, ParamArray additionalContentTypes As String()) As RouteHandlerBuilder

参数

statusCode
Int32

响应状态代码。

responseType
Type

响应的类型。 默认为“null”。

contentType
String

响应内容类型。 如果 responseType 不为 null,则默认为“application/json”,否则默认为 null。

additionalContentTypes
String[]

终结点为提供的状态代码生成的其他响应内容类型。

返回

可用于 RouteHandlerBuilder 进一步自定义终结点的 。

适用于

Produces<TResponse>(RouteHandlerBuilder, Int32, String, String[])

IProducesResponseTypeMetadataMetadata为 生成builder的所有终结点将 添加到 。

public static Microsoft.AspNetCore.Builder.RouteHandlerBuilder Produces<TResponse> (this Microsoft.AspNetCore.Builder.RouteHandlerBuilder builder, int statusCode = 200, string? contentType = default, params string[] additionalContentTypes);
static member Produces : Microsoft.AspNetCore.Builder.RouteHandlerBuilder * int * string * string[] -> Microsoft.AspNetCore.Builder.RouteHandlerBuilder
<Extension()>
Public Function Produces(Of TResponse) (builder As RouteHandlerBuilder, Optional statusCode As Integer = 200, Optional contentType As String = Nothing, ParamArray additionalContentTypes As String()) As RouteHandlerBuilder

类型参数

TResponse

响应的类型。

参数

statusCode
Int32

响应状态代码。 默认为 Status200OK

contentType
String

响应内容类型。 默认为“application/json”。

additionalContentTypes
String[]

终结点为提供的状态代码生成的其他响应内容类型。

返回

可用于 RouteHandlerBuilder 进一步自定义终结点的 。

适用于