RequestDelegateFactory.Create Method

Definition

Overloads

Create(Delegate, RequestDelegateFactoryOptions)

Source:
RequestDelegateFactory.cs

Creates a RequestDelegate implementation for handler.

C#
public static Microsoft.AspNetCore.Http.RequestDelegateResult Create (Delegate handler, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions? options = default);
C#
public static Microsoft.AspNetCore.Http.RequestDelegateResult Create (Delegate handler, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions? options);

Parameters

handler
Delegate

A request handler with any number of custom parameters that often produces a response with its return value.

options
RequestDelegateFactoryOptions

The RequestDelegateFactoryOptions used to configure the behavior of the handler.

Returns

The RequestDelegateResult.

Applies to

ASP.NET Core 9.0 ja muut versiot
Tuote Versiot
ASP.NET Core 6.0, 7.0, 8.0, 9.0

Create(Delegate, RequestDelegateFactoryOptions, RequestDelegateMetadataResult)

Source:
RequestDelegateFactory.cs

Creates a RequestDelegate implementation for handler.

C#
public static Microsoft.AspNetCore.Http.RequestDelegateResult Create (Delegate handler, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions? options = default, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult? metadataResult = default);

Parameters

handler
Delegate

A request handler with any number of custom parameters that often produces a response with its return value.

options
RequestDelegateFactoryOptions

The RequestDelegateFactoryOptions used to configure the behavior of the handler.

metadataResult
RequestDelegateMetadataResult

The result returned from InferMetadata(MethodInfo, RequestDelegateFactoryOptions) if that was used to inferring metadata before creating the final RequestDelegate. If null, this call to Create(Delegate, RequestDelegateFactoryOptions, RequestDelegateMetadataResult) method will infer the metadata that InferMetadata(MethodInfo, RequestDelegateFactoryOptions) would have inferred for the same Method and populate EndpointBuilder with that metadata. Otherwise, this metadata inference will be skipped as this step has already been done.

Returns

The RequestDelegateResult.

Applies to

ASP.NET Core 9.0 ja muut versiot
Tuote Versiot
ASP.NET Core 7.0, 8.0, 9.0

Create(MethodInfo, Func<HttpContext,Object>, RequestDelegateFactoryOptions)

Source:
RequestDelegateFactory.cs

Creates a RequestDelegate implementation for methodInfo.

C#
public static Microsoft.AspNetCore.Http.RequestDelegateResult Create (System.Reflection.MethodInfo methodInfo, Func<Microsoft.AspNetCore.Http.HttpContext,object>? targetFactory = default, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions? options = default);
C#
public static Microsoft.AspNetCore.Http.RequestDelegateResult Create (System.Reflection.MethodInfo methodInfo, Func<Microsoft.AspNetCore.Http.HttpContext,object>? targetFactory, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions? options);

Parameters

methodInfo
MethodInfo

A request handler with any number of custom parameters that often produces a response with its return value.

targetFactory
Func<HttpContext,Object>

Creates the this for the non-static method.

options
RequestDelegateFactoryOptions

The RequestDelegateFactoryOptions used to configure the behavior of the handler.

Returns

The RequestDelegate.

Applies to

ASP.NET Core 9.0 ja muut versiot
Tuote Versiot
ASP.NET Core 6.0, 7.0, 8.0, 9.0

Create(MethodInfo, Func<HttpContext,Object>, RequestDelegateFactoryOptions, RequestDelegateMetadataResult)

Source:
RequestDelegateFactory.cs

Creates a RequestDelegate implementation for methodInfo.

C#
public static Microsoft.AspNetCore.Http.RequestDelegateResult Create (System.Reflection.MethodInfo methodInfo, Func<Microsoft.AspNetCore.Http.HttpContext,object>? targetFactory = default, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions? options = default, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult? metadataResult = default);

Parameters

methodInfo
MethodInfo

A request handler with any number of custom parameters that often produces a response with its return value.

targetFactory
Func<HttpContext,Object>

Creates the this for the non-static method.

options
RequestDelegateFactoryOptions

The RequestDelegateFactoryOptions used to configure the behavior of the handler.

metadataResult
RequestDelegateMetadataResult

The result returned from InferMetadata(MethodInfo, RequestDelegateFactoryOptions) if that was used to inferring metadata before creating the final RequestDelegate. If null, this call to Create(Delegate, RequestDelegateFactoryOptions, RequestDelegateMetadataResult) method will infer the metadata that InferMetadata(MethodInfo, RequestDelegateFactoryOptions) would have inferred for the same Method and populate EndpointBuilder with that metadata. Otherwise, this metadata inference will be skipped as this step has already been done.

Returns

The RequestDelegate.

Applies to

ASP.NET Core 9.0 ja muut versiot
Tuote Versiot
ASP.NET Core 7.0, 8.0, 9.0