SimpleInjectorAddOptionsAspNetCoreExtensionsAddAspNetCore Method

Simple Injector
Adds basic Simple Injector integration for ASP.NET Core and returns a builder object that allow additional integration options to be applied. These basic integrations includes wrapping each web request in an AsyncScopedLifestyle scope and making the nessesary changes that make it possible for enabling the injection of framework components in Simple Injector-constructed components when UseSimpleInjector(IServiceProvider, Container, ActionSimpleInjectorUseOptions) is called.

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

public static SimpleInjectorAspNetCoreBuilder AddAspNetCore(
	this SimpleInjectorAddOptions options


Type: SimpleInjector.Integration.ServiceCollectionSimpleInjectorAddOptions
The options to which the integration should be applied.

Return Value

Type: SimpleInjectorAspNetCoreBuilder
A new SimpleInjectorAspNetCoreBuilder instance that allows additional configurations to be made.

Usage Note

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

ArgumentNullExceptionThrown when options is null.
See Also