All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- Dropped support for .NET Framework 4.5. We now only provide support for the .NET Framework 4.6 and .NET Standard 2.0 target frameworks.
- Changed return value of IBindingResolver (and implementing classes) from
IEnumerable<IBinding>
toICollection<IBinding>
. - Changed return value of
ISelector.SelectConstructorsForInjection(Type type)
(and implementing classes) fromIEnumerable<ConstructorInfo>
toConstructorInfo[]
. - The
T Get<T>(string key, T defaultValue)
andvoid Set(string key, object value)
methods have been removed from (I)NinjectSettings. - The
GetBindings(Type service)
method in (I)KernelConfiguration, (I)ReadOnlyKernel and KernelBase now returnsIBinding[]
instead ofIEnumerable<IBinding>
. - Added a PropertyInjection setting that can be used to control whether property injection is enabled. By default, property injection is enabled.
- Added a MethodInjection setting that can be used to control whether method injection is enabled. By default, method injection is enabled.
- Call
kernel.Get<T>()
two times do not give the same result #262
- Throw cyclic dependency exception when resolve a named binding with decoration pattern #261
- Removed debug code.
- Ninject for .NET Core can now load extensions automatically.
- Added back CLSCompliant(true)
- Added back CLSCompliant(true)
- Removed executing assembly's directory from the base directories.
- Ninject for .NET Core can now load extensions automatically.
- The executing assembly's directory is considered as one of the base directories.
- Support
kernel.Get<IEnumerable<IFoo>>()
#252
- Moved BindingPrecedenceComparer to Bindings folder.
- The
GetValues
andGetValue
methods ofTarget
are obsolete.
- Cyclical dependency check throws false positive for decorator pattern #251
- Renamed ReleaseNotes.md to CHANGELOG.md and updated the format.
- Support .NET Standard 2.0
- Strongly typed overloads of
WithConstructorArgument
which use a callback to get the value #197 - Do not choose constructors with an
ObsoleteAttribute
#224 - Meaningful exception message if there is error in configuration #240 #245
- Using
HasDefaultValue
instead ofDBNull
#235 - Array/List of concrete classes will return empty if the concrete class is not explicitly binded #227
- Support for .NET 3.5 and Silverlight
- Improved cyclical dependencies detection #143
InvalidProgramException
when select constructors forMulticastDelegate
#175WhenMemberHas
broken #189- Injection into private parent parent properties fails #214 #217
- Break Singleton / circular dependency
WithPropertyValue
orOnActivation
callback #221 #224 - The invoked member is not supported in a dynamic assembly #225
- Conditional binding is not being considered when score constructors #237
- bool IRequest.ForceUnique: In case there is an uncoditional and a conditional binding, return the conditional one. In case there are multiple unconditional or conditional bindings, throw an exception.
- IResolutionRoot.TryGetAndThrowOnInvalidBinding (extension method): Returns null if there is no binding, but throws ActivationException in case there is a binding which could not be activated.
- TypeMatchingConstructorArgument introduced.
- ToConstructor() can now accept results from methods as argument e.g. ToConstructor(_ => new Foo(this.GetBar())
- WhenNoAncestorMatches, WhenAnyAncestorMatches and WhenNoAncestorNamed When overloads
- WeakConstructorArgument and WeakPropertyValue that keep a weak reference to the value only so that Ninject has no reference on them when caching the created instance.
- Overloads for WhenInjectedInto and WhenInjectedExactlyInto that take multiple types to support multiple allowed parents.
- Added WhenAnyAncestorNamed and marked mispelled WhenAnyAnchestorNamed as obsolete
- Release method was moved from IKernel to the IResolutionRoot interface
- Private properties of base class were not checked for existence of setter and Inject attribute
- When an object that is the scope of another object is released an Exception was thrown.
- The default scope can be changed in the NinjectSettings using
- Open generics can now be passed to WhenInjectedInto
- Fixed race condition in the GarbageCollectionCachePruner
- The constructor scorer ignores implicit bindings
- The constructor scorer ignores self bindings
- Support for default parameters. If not explicit binding exists for a dependency but there is default value defined it is used instead.
- Support to define the constructor and constructor arguments using ToConstructor "to" overload
- WhenInjectedExactlyInto When overload: Matches only if the target is exactly the specified type. This was the behavior of WhenInjectedInto in Ninject 2.2.
- WhenAnyAnchestorNamed. Matches if any of the anchestor bindings is named with the specified name.
- Default binding for IResolutionRoot that returns the kernel.
- Open generic bindings can be overriden by closed generics for specific types.
- Support for extensions that they can define bindings that return the same instance for different interfaces (interface segregation principle).
- Generic Overloads for OnActivation and OnDeactivation that can be used to cast the implementation type.
- Bind<T1,T2, ...>() to define multiple interfaces for one service.
- Rebind<T1,T2, ...>() to define multiple interfaces for one service.
- Support to inject constructor arguments to deeper levels using new ConstructorArgument("name", value, true)
- WhenInjectedInto matches also if the target derives from the specified type.
- ToConstant bindings are in singleton scope by default
- Separate project for medium trust environments.
- Open generic bindings can be overwritten by closed generic bindings
- Ninject modules have a new method VerifyRequiredModulesAreLoaded to check if their dependencies are loaded.
- If several constructors have the same score an ActivationExcpetion is thrown.
- No web builds. All builds are have no reference to web anymore
- Breaking change: Get all will now return all bindings and not skip unconditional ones anymore in case there is a conditional one. This is the same behavior as the version 2.0.1 and bevore had.
- Fixed that the CF and SL version of the activation cache did not properly remove the weak references
- (for CF): The CF version threw an exception when a class had a generic method on a base class. This bugfix has the side effect that the Inject attribute cannot be defined on base methods anymore. It has to be defined on the overriden method!
- The constructor scorer accepts default values
- The constructor scorer accepts self bindings
- For classes that have several virtual indexers and at least one of them overridden an ambiguous match exception was thrown when they were injected.