Stashbox Versions Save

A lightweight, fast, and portable dependency injection framework for .NET-based solutions.

5.14.1

2 months ago

Fixed

  • #163: Last-write win problem when hash collision happens.

5.14.0

5 months ago

Added

  • WithRequiredMemberInjection() registration and container configuration option to control the auto injection of required members.

5.13.0

6 months ago

Added

  • .NET 8.0 target.
  • #134 Concept of Auto lifetime:
    • It aligns to the lifetime of the resolved service's dependencies. When the underlying service has a dependency with a higher lifespan, this lifetime will inherit that lifespan up to a given boundary.
  • Auto injection of required members.
  • MS.DI compatibility features for supporting keyed services:
    • DependencyName attribute. When a parameter is marked with this attribute, the container will pass the given dependency's name to it.
    • WithUniversalName() container configuration method. It sets the universal name which is a special name that allows named resolution work for any given name.
    • WithAdditionalDependencyNameAttribute() container configuration method. It adds an attribute type that is considered a dependency name indicator just like the DependencyName attribute.
    • WithAdditionalDependencyAttribute() container configuration method. It adds an attribute type that is considered a dependency indicator just like the Dependency attribute.

5.12.2

9 months ago

Fixed

  • There was an issue where using decorators with instance registrations resulted in resolution failure.

5.12.1

9 months ago

Fixed

  • #144: There was a case where closed generic decorators were not taken into account during service resolution.
  • #143: Child scopes attached to their parents were not removed from disposal tracking when they were disposed individually.
  • #141: There was a case where wrong decorators were selected during an IEnumerable<T> resolution call.

5.11.1

9 months ago

Fixed

  • #142: Upon disposing child containers, their parents still held a strong reference to them.

5.11.0

11 months ago

Changed

  • Moved several functions of IDependencyResolver to extension methods.

5.10.2

11 months ago

Added

  • Access to the actual TypeInformation as a factory delegate input parameter. The TypeInformation holds every reflected context information about the currently resolving type. This can be useful when the resolution is, e.g., in an open generic context, and we want to know which closed generic variant is requested.
    container.Register(typeof(IService<>), options => options.WithFactory<TypeInformation>(typeInfo => 
       {
          /* typeInfo.Type holds the currently resolving closed generic type */
       }));
    

5.10.1

1 year ago

Added

  • ParentDependency flag for ResolutionBehavior. It indicates that parent containers (including indirect all ancestors) can only provide dependencies for services that are already selected for resolution.

Fixed

  • During factory resolution, the type map check failed for registrations like: .Register<IService>(c => c.WithFactory(/* ... */).AsServiceAlso<IAnother>()). Now, the container gets the implementation type from the generic context where it's possible.

5.10.0

1 year ago

Changed

  • Each Resolve() method now accepts a ResolutionBehavior flag parameter. It determines which level of the container hierarchy can take part in the service resolution. Possible values:
    • Parent: Indicates that parent containers (including indirect all ancestors) can participate in the resolution request's service selection.
    • Current: Indicates that the current container (which initiated the resolution request) can participate in the service selection.
    • Default: The default behavior, it's used when the parameter is not specified. Its value is Parent | Current, so the parents and the current (which initiated the resolution request) container can participate in the resolution request's service selection.
  • CreateChildContainer() now accepts an attachToParent boolean parameter, which indicates whether the parent container's disposal should also dispose the child. It defaults to true.
  • ITenantDistributor and TenantDistributor types became obsolete. Their functionality is available on IStashboxContainer.
    • ITenantDistributor.ConfigureTenant() -> IStashboxContainer.CreateChildContainer()
    • ITenantDistributor.GetTenant() -> IStashboxContainer.GetChildContainer()
  • Calling Validate() on a container will execute validation on each of its child container if it has any.

Fixed

  • IEnumerable<T> and ResolveAll() requests were not taking services in parent containers into account. Now, it respects the given ResolutionBehavior and as its default value is Parent | Current, IEnumerable<T> requests will return services from parent containers by default.
  • Decorator selection during a resolution request was not take parent containers into consideration. It now respects the given ResolutionBehavior parameter.