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

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


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

Type Parameters

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