SimpleInjectorAspNetCoreIntegrationExtensionsUseMiddlewareTMiddleware Method

Simple Injector
Adds a middleware type to the application's request pipeline. The middleware will be resolved from the supplied the Simple Injector container. The middleware will be added to the container for verification.

Namespace:  SimpleInjector
Assembly:  SimpleInjector.Integration.AspNetCore (in SimpleInjector.Integration.AspNetCore.dll) Version: 4.6.0
Syntax

public static IApplicationBuilder UseMiddleware<TMiddleware>(
	this IApplicationBuilder app,
	Container container
)
where TMiddleware : class, IMiddleware

Parameters

app
Type: IApplicationBuilder
The IApplicationBuilder instance.
container
Type: SimpleInjectorContainer
The container to resolve TMiddleware from.

Type Parameters

TMiddleware
The middleware type.

Return Value

Type: IApplicationBuilder
The supplied IApplicationBuilder instance.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IApplicationBuilder. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference