Releases: DevTeam/Pure.DI
2.2.15
π What's New in This Release
Key Enhancements:
- Improved examples
- Improved project templates
- Including Rider Junieβs guidelines
- .NET 10 support
- Reorganized AI-related docs and guidance
Full Changelog: 2.2.14...2.2.15
2.2.14
π What's New in This Release
π Critical Fixes:
- #124 Mulitple binding (as attributes) sometimes fail to be properly resolved in a single dependency graph
Full Changelog: 2.2.13...2.2.14
2.3.0
Whatβs New in This Release
Backward Incompatibility
By default, starting with version 2.3.0, no constructors are generated for a composition. The actual set of constructors depends on the composition arguments and lifetime scopes.
Parameterized constructor (automatic generation)
If the composition has any arguments defined, Pure.DI automatically generates a public parameterized constructor that includes all specified arguments.
Example configuration:
DI.Setup("Composition")
.Arg<string>("name")
.Arg<int>("id")
// ...Resulting constructor:
public Composition(string name, int id) { /* ... */ }Important notes:
- Only arguments that are actually used in the object graph appear in the constructor.
- Unused arguments are omitted to optimize resource usage.
- If no arguments are specified, no parameterized constructor is created.
Scopeβrelated constructors (conditional generation)
If there is at least one binding with Lifetime.Scoped, Pure.DI generates two constructors:
Public default constructor
Used for creating the root scope instance.
public Composition() { /* ... */ }Internal constructor with parent scope
Used for creating child scope instances. This constructor is internal and accepts a single parameter β the parent scope.
internal Composition(Composition parentScope) { /* ... */ }Important notes:
- The public default constructor enables initialization of the root composition.
- The internal constructor with parent reference enables proper scoping hierarchy for
Lifetime.Scopeddependencies. - These constructors are only generated when
Lifetime.Scopedbindings exist in the composition.
Summary of constructor generation rules
- No arguments + no Scoped lifetimes: no constructors generated.
- Arguments present: public parameterized constructor with all used arguments.
- At least one Scoped lifetime: two constructors (public default + internal with parent).
- Both arguments and Scoped lifetimes: all three constructors (parameterized, public default, internal with parent).
Key Enhancements
- Improved
GetHashCode()usage for type resolution with .NET Coreβ―3.0+ support:
ReplacedRuntimeHelpers.GetHashCode()withType.TypeHandle.GetHashCode(). - Enhanced type comparison: switched from
==toReferenceEqualsfor more effective type comparison. - Refined error and warning messages: improved clarity and detail in diagnostic output to aid troubleshooting.
- Expanded localization support: added translations for the following languages:
- Korean
- Italian
- Hebrew
- Bengali
- Indonesian
- Vietnamese
- Thai
- Extended dependency injection capabilities: methods, fields, and properties now support dependency injection when annotated with attributes such as
TypeandTag(previously available forOrdinal,Inject, andDependency). - Multiple
BindAttributesupport: now allows the use of severalBindAttributeinstances on a single target. - Generic type argument marker: introduced support for reference types with a public parameterless constructor.
- Private fields of composition now be annotated with the
[NonSerialized]attribute to explicitly indicate their exclusion from serialization. - Improved example projects for Unity.
π Critical Fixes
- Prevented infinite loops in dependency graph construction: resolved an issue that could cause infinite loops when errors occurred during graph building.
- Array type root support: added proper handling of array type as a root.
- Actionβbased injection support: implemented support for injection scenarios involving
Actiondelegates.
2.2.13
π What's New in This Release
Key Enhancements:
-
Object Lifecycle Optimization
When working with dependencies, it's important to choose the right object lifetime. For example, if an object with PerResolve is used only once in the entire composition, it's more efficient to apply Transient.
This provides two key benefits:
- Reduced system load
- Elimination of the need for thread synchronization
This approach allows optimizing application performance and using system resources more efficiently.
Pure.DI implements this optimization automatically. For exampple, when the Pure.DI detects that an object with
PerResolvelifetime is injected only once across the entire object composition, it automatically switches toTransientlifetime. This automation helps developers save time and ensures optimal resource usage without manual intervention. This automatic optimization mechanism is not limited to thePerResolvelifetime. Similar optimizations can be applied to other lifetime management strategies.Pure.DI intelligently analyzes the usage patterns and context of each object to determine the most efficient lifetime strategy, ensuring optimal performance across the entire application.
π Critical Fixes:
- #123 Overrides do not work with complex expressions
Full Changelog: 2.2.12...2.2.13
2.1.12
π What's New in This Release
Key Enhancements:
- #119
IContext.Locksupport, see this example for details - #120
Locksupport for static roots, see this example for details - Uses
CannotResolveExceptioninstead ofInvalidOperationException - Improved API documentation
Full Changelog: 2.2.11...2.2.12
2.2.11
π What's New in This Release
Key Enhancements:
- #118 ref constructor parameters support, see this example for details
- #117 IContext.ConsumerType support, see this example for details
Full Changelog: 2.2.10...2.2.11
2.2.10
π What's New in This Release
π Fixes:
- #116 Invalid list of consumer types in
IContext.ConsumerTypes
Full Changelog: 2.2.9...2.2.10
2.2.9
π What's New in This Release
π Fixes:
- Fixes a state synchronization issue within local functions that sometimes occurs
- Fix formatting of generated code
- Fix comments for the constructor arguments
Full Changelog: 2.2.8...2.2.9
2.2.8
π What's New in This Release
Key Enhancements:
- Optimization of object composition
- Significant reduction in generation time and size of complex compositions
Full Changelog: 2.2.7...2.2.8
2.2.7
π What's New in This Release
Key Enhancements:
β Support for inherited compositions, see this example for details
β #115 Improve API for using ServiceProviderFactory base class for Microsoft DI integration β remove DependsOn(Base), see this example for details
β Added Enity Framework example
Full Changelog: 2.2.6...2.2.7