SimpleInjectorUseOptionsAspNetCoreExtensionsUseMiddleware Method (SimpleInjectorUseOptions, Type, IApplicationBuilder)

Simple Injector

Note: This API is now obsolete.

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

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

[ObsoleteAttribute("Please call IApplicationBuilder.UseMiddleware(Type, Container) instead. This method can cause your middleware to be applied at the wrong stage in the pipeline. This will, for instance, cause your middleware to be executed before the static files middleware (i.e. the .UseStaticFiles() call) or before authorization is applied (i.e. the .UseAuthorization() call). Instead, take care that you call .UseMiddleware<TMiddleware>(Container) at the right stage. This typically means after .UseStaticFiles() and .UseAuthorization(), but before .UseEndpoints(...). See https://simpleinjector.org/aspnetcore for more information. Will be removed in version 5.0.", 
	true)]
public static void UseMiddleware(
	this SimpleInjectorUseOptions options,
	Type middlewareType,
	IApplicationBuilder app
)

Parameters

options
Type: SimpleInjectorSimpleInjectorUseOptions
The SimpleInjectorUseOptions.
middlewareType
Type: SystemType
The middleware type.
app
Type: IApplicationBuilder
The IApplicationBuilder instance.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type SimpleInjectorUseOptions. 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