Skip to content

Releases: DevTeam/Pure.DI

2.2.15

17 Dec 10:00

Choose a tag to compare

πŸš€ 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

01 Nov 13:09

Choose a tag to compare

πŸš€ 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

27 Dec 07:48

Choose a tag to compare

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.Scoped dependencies.
  • These constructors are only generated when Lifetime.Scoped bindings 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:
    Replaced RuntimeHelpers.GetHashCode() with Type.TypeHandle.GetHashCode().
  • Enhanced type comparison: switched from == to ReferenceEquals for 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 Type and Tag (previously available for Ordinal, Inject, and Dependency).
  • Multiple BindAttribute support: now allows the use of several BindAttribute instances 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 Action delegates.

2.2.13

25 Sep 10:24

Choose a tag to compare

πŸš€ 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 PerResolve lifetime is injected only once across the entire object composition, it automatically switches to Transient lifetime. This automation helps developers save time and ensures optimal resource usage without manual intervention. This automatic optimization mechanism is not limited to the PerResolve lifetime. 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

19 Sep 06:05

Choose a tag to compare

πŸš€ What's New in This Release

NuGet package

Key Enhancements:

  • #119 IContext.Lock support, see this example for details
  • #120 Lock support for static roots, see this example for details
  • Uses CannotResolveException instead of InvalidOperationException
  • Improved API documentation

Full Changelog: 2.2.11...2.2.12

2.2.11

12 Sep 11:16

Choose a tag to compare

πŸš€ What's New in This Release

NuGet package

Key Enhancements:

Full Changelog: 2.2.10...2.2.11

2.2.10

11 Sep 15:05

Choose a tag to compare

πŸš€ What's New in This Release

NuGet package

πŸ› Fixes:

  • #116 Invalid list of consumer types in IContext.ConsumerTypes

Full Changelog: 2.2.9...2.2.10

2.2.9

03 Sep 08:01

Choose a tag to compare

πŸš€ What's New in This Release

NuGet package

πŸ› 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

02 Sep 12:03

Choose a tag to compare

πŸš€ What's New in This Release

NuGet package

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

01 Sep 09:18

Choose a tag to compare

πŸš€ What's New in This Release

NuGet package

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