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.9.0

[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 for more information. Will be removed in version 5.0.", 
public static void UseMiddleware(
	this SimpleInjectorUseOptions options,
	Type middlewareType,
	IApplicationBuilder app


Type: SimpleInjectorSimpleInjectorUseOptions
The SimpleInjectorUseOptions.
Type: SystemType
The middleware type.
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