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)
is called.
Namespace: SimpleInjector
Assembly: SimpleInjector.Integration.AspNetCore (in SimpleInjector.Integration.AspNetCore.dll) Version: 5.0.0
Syntax
public static SimpleInjectorAspNetCoreBuilder AddAspNetCore( this SimpleInjectorAddOptions options )
Parameters
- options
- Type: SimpleInjector.Integration.ServiceCollectionSimpleInjectorAddOptions
The options to which the integration should be applied.
Return Value
Type: SimpleInjectorAspNetCoreBuilderA 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).Exceptions
Exception | Condition |
---|---|
ArgumentNullException | Thrown when options is null. |
See Also