NOTE: This is NOT the latest release. Please click on the Downloads tab above to find the latest Simple Injector release.
The two main areas of improvement for Simple Injector 2.7 are diagnostics and collections.
Two new diagnostic warnings have been added that detect common configuration mistakes. The Torn Lifestyle diagnostic warning
detects cases where the user has made multiple registrations with the same lifestyle that map to the same component. The Disposable Transient Component diagnostic warning
signals the registration of a transient component that implements IDisposable
, because transients are not disposed by the container.
Collection support has been highly improved. Besides the existing support for IEnumerable<T>
, the container now allows resolving and injecting IList<T>
and arrays as well. Besides this, the container now resolves all variant (both covariant, contravariant, or any combination) elements
of a registered collection and the AppendToCollection
extension method from the SimpleInjector.Advanced
namespace allows appending any non-generic, closed-generic, partially closed-generic and open-generic type to an existing collection.
New features and improvements for the SimpleInjector.dll
- Added support for resolving IList<T> and ICollection<T>. (work item 20981)
- Added support for resolving arrays. (work item 20982)
- Added 'torn lifestyle' diagnostic warning. (work item 20975)
- Added 'disposable transient' diagnostic warning . (work item 20957)
- Added support for resolving assignable variant implementations in collections registered with RegisterAll. (work item 20984)
- AppendToCollection extension methods now support open-generic types. (work item 20985)
Bug fixes for the SimpleInjector.dll
- In case a constructor of a type contained a primitive dependency, while the type was resolved as part of a collection or directly by building the Registration, the thrown exception message was misleading. (work item 20986)
New features and improvements for the SimpleInjector.Integration.WebApi.dll
- New RegisterWebApiControllers overload added to the SimpleInjectorWebApiExtensions class that allows specifying the assemblies to search through. This is useful during testing where the default IAssemblyResolver can't be used. (work item 20990)