Simple Injector v4.9
Release Notes
Simple Injector can be downloaded using NuGet.
The most prominent improvements in this release are:
- Core library:
- Support for using
ReadOnlyCollection<T>in the core library. - The container's Lifestyle Mismatch verification behavior can now be set to a less strict model allowing
Transientdependencies to be injected intoScopedconsumers using theContainer.Options.UseLoosenedLifestyleMismatchBehaviorconfiguration switch.
- Support for using
- ASP.NET Core integration:
- The container is now automatically disposed on web application shutdown, unless overridden using
services.AddSimpleInjector(container, options => { options.DisposeContainerWithServiceProvider = false; }). - Scoped
IAsyncDisposablecomponents, created by Simple Injector during the course of a web request, will now be automatically, and asynchronously disposed.
- The container is now automatically disposed on web application shutdown, unless overridden using
Improvements
Simple Injector core library
- #762 Support for resolving and injecting
ReadOnlyCollection<T>collections added - #781 Reports existing interface registrations when
Options.ResolveUnregisteredConcreteTypesis false - #793 Added option to loosen the Lifestyle Mismatch verification behavior.
ServiceCollection Integration package
- #787 The
Containerinstance is now automatically appended to theIServiceCollectionto simplify some integration scenarios.
ASP.NET Core Integration packages
- #763 Allow Simple Injector container to be automatically disposed when integrated into ASP.NET Core
- #778 Added support for
IAsyncDisposable. The ASP.NET Core integration package will now automatically do asynchronous disposal of scopedIAsyncDisposabledependencies within the context of a web request. - #730 Fixed an invalid message in an
ObsoleteAttribute - #794 Some obsoleted messages are now marked with
error: trueand now cause compile errors.
The following class members are now marked obsolete:
SimpleInjectorAspNetCoreMvcIntegrationExtensions.RegisterMvcControllers(Container, IApplicationBuilder)SimpleInjectorAspNetCoreMvcIntegrationExtensions.RegisterMvcViewComponents(Container, IApplicationBuilder)SimpleInjectorAspNetCoreMvcIntegrationExtensions.RegisterMvcViewComponents(Container, IViewComponentDescriptorProvider)SimpleInjectorAspNetCoreMvcIntegrationExtensions.AddSimpleInjectorTagHelperActivationSimpleInjectorAspNetCoreMvcIntegrationExtensions.RegisterPageModelsSimpleInjectorAspNetIntegrationExtensions.EnableSimpleInjectorCrossWiring(IServiceCollection, Container)SimpleInjectorAspNetIntegrationExtensions.CrossWire<TService>(Container, IApplicationBuilder)SimpleInjectorAspNetIntegrationExtensions.CrossWire(Container, Type, IApplicationBuilder)SimpleInjectorAspNetIntegrationExtensions.AutoCrossWireAspNetComponents(Container, IApplicationBuilder)SimpleInjectorAspNetIntegrationExtensions.AutoCrossWireAspNetComponents(Container, IServiceProvider)SimpleInjectorUseOptionsAspNetCoreExtensions.UseMiddleware<TMiddleware>(SimpleInjectorUseOptions, IApplicationBuilder)SimpleInjectorUseOptionsAspNetCoreExtensions. UseMiddleware(SimpleInjectorUseOptions, Type, IApplicationBuilder)