Class ConfigurableMiddleware<T, TOptions>
Provides an base-class for configurable middleware implementation in ASP.NET Core that supports the options pattern with a dependency injected parameter.
Implements
Namespace: Cuemon.AspNetCore
Assembly: Cuemon.AspNetCore.dll
Syntax
public abstract class ConfigurableMiddleware<T, TOptions> : ConfigurableMiddlewareCore<TOptions>, IConfigurable<TOptions> where TOptions : class, new()
Type Parameters
Name | Description |
---|---|
T | The type of the dependency injected parameter of Invoke |
TOptions | The type of the options to setup. |
Constructors
| Improve this DocConfigurableMiddleware(RequestDelegate, IOptions<TOptions>)
Initializes a new instance of the ConfigurableMiddleware<TOptions> class.
Declaration
protected ConfigurableMiddleware(RequestDelegate next, IOptions<TOptions> setup)
Parameters
Type | Name | Description |
---|---|---|
Microsoft. |
next | The delegate of the request pipeline to invoke. |
Microsoft. |
setup | The Microsoft.Extensions.Options.IOptions<TOptions> which need to be configured. |
ConfigurableMiddleware(RequestDelegate, Action<TOptions>)
Initializes a new instance of the ConfigurableMiddleware<TOptions> class.
Declaration
protected ConfigurableMiddleware(RequestDelegate next, Action<TOptions> setup)
Parameters
Type | Name | Description |
---|---|---|
Microsoft. |
next | The delegate of the request pipeline to invoke. |
System. |
setup | The System.Action<T> which need to be configured. |
Methods
| Improve this DocInvokeAsync(HttpContext, T)
Executes the ConfigurableMiddleware<T, TOptions>.
Declaration
public abstract Task InvokeAsync(HttpContext context, T di)
Parameters
Type | Name | Description |
---|---|---|
Microsoft. |
context | The context of the current request. |
T | di | The dependency injected parameter of Invoke |
Returns
Type | Description |
---|---|
System. |
A task that represents the execution of this middleware. |