Releases: z4kn4fein/stashbox
Releases · z4kn4fein/stashbox
Stashbox v5.14.1
Stashbox v5.14.0
Added
WithRequiredMemberInjection()
registration and container configuration option to control the auto injection ofrequired
members.
Stashbox v5.13.0
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 theDependencyName
attribute.WithAdditionalDependencyAttribute()
container configuration method. It adds an attribute type that is considered a dependency indicator just like theDependency
attribute.
Stashbox v5.12.2
Fixed
- There was an issue where using decorators with instance registrations resulted in resolution failure.
Stashbox v5.12.1
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.
Stashbox v5.11.1
Fixed
- #142: Upon disposing child containers, their parents still held a strong reference to them.
Stashbox v5.11.0
Changed
- Moved several functions of
IDependencyResolver
to extension methods.
Stashbox v5.10.2
Added
- Access to the actual
TypeInformation
as a factory delegate input parameter. TheTypeInformation
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 */ }));
Stashbox v5.10.1
Added
ParentDependency
flag forResolutionBehavior
. 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.
Stashbox v5.10.0
Changed
- Each
Resolve()
method now accepts aResolutionBehavior
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 isParent | 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 anattachToParent
boolean parameter, which indicates whether the parent container's disposal should also dispose the child. It defaults totrue
.ITenantDistributor
andTenantDistributor
types became obsolete. Their functionality is available onIStashboxContainer
.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>
andResolveAll()
requests were not taking services in parent containers into account. Now, it respects the givenResolutionBehavior
and as its default value isParent | 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.