Releases: z4kn4fein/stashbox
Stashbox v5.2.1
Fixed
- Consolidate
Resolve()
API, using method overloads instead of optional parameters.
Stashbox v5.2.0
Fixed
- Unable to resolve IHubContext. #114
Added
- Null-safety by enabling null-state analysis.
- Option to exclude a factory's result from dispose tracking, even if it would be tracked by default. This gives the ability to decide within the factory delegate that the result should be tracked or not.
.Register<Service>(options => options .WithFactory<IRequestContext>(requestContext => requestContext.ExcludeFromTracking(/* get an existing or instantiate a new service */) ) );
- A new
ResolveFactoryOrDefault()
method that allowsnull
results. - A new
ResolveOrDefault()
method that allowsnull
results. ValueTuple<,>
metadata support.
Changed
Resolve()
with thenullResultAllowed
parameter became obsolete, it was replaced byResolveOrDefault()
.- Each
ResolveFactory<>()
method became obsolete as their functionality is equivalent toResolve<Func<>>()
.
Removed
nullResultAllowed
parameter ofResolveFactory()
.
Stashbox v5.1.0
Changed
- Marked the
.WithRuntimeCircularDependencyTracking()
container configuration option as Obsolete in favor of parameterized factory delegates.
Stashbox v5.0.1
Changed
- Converted the
ServiceContext
to a read-only struct. - Made the
.AsServiceContext()
extension method ofExpression
public.
Stashbox v5.0.0
Added
- Additional metadata registration option.
- Support for requesting a service along with its identifier.
- Support for per-request lifetime.
- New, clearer API for wrapper extensions.
Fixed
- There was a bug in the expression compiler that resulted in wrong IL generation in case of value types inside
IEnumerable<>
.
Changed
-
Tuple<>
requests are not resolved with services in all its items anymore. It's became part of the newly introduced resolution with metadata feature. -
The
IResolver
interface became the base for the newly introducedIServiceWrapper
andIServiceResolver
interfaces. These became the main entrypoints for container extensions. -
To make the dependency overrides available in factories the
IResolutionContext
was bound to the generated expression tree and the compiled delegate. (#105) This temporary solution could lead issues as the resolution context is static between the compiled delegates, however the dependency overrides are not.To resolve this, a new
IRequestContext
parameter is introduced for each compiled factory delegate that can be used to access overrides. (The same context object is used to produce and track per-request services)container.Register<Service>(options => options. WithFactory<IRequestContext>(requestContext => { // access the overrides through: requestContext.GetOverrides() // or: requestContext.GetDependencyOverrideOrDefault<OverrideType>() }))
Removed
- Support of circular dependencies with
Lazy<>
along with the.WithCircularDependencyWithLazy()
container configuration option.
Stashbox v4.1.0
Fixed
IsRegistered()
returnstrue
only when the container has a registration with the given type (and name).CanResolve()
returnstrue
only when at least one of the following is true:- The given type is registered in the current or one of the parent containers.
- The given type is a closed generic type and its open generic definition is registered.
- The given type is a wrapper (
IEnumerable<>
,Lazy<>
,Func<>
, orTuple<>
) and the underlying type is registered. - The given type is not registered but it's resolvable and the unknown type resolution is enabled.
Stashbox v4.0.0
Removed
- .NET 4.0 support.
Stashbox v3.6.4
Stashbox v3.6.3
Stashbox v3.6.2
Fixed
- Rare NullReferenceException on Resolve. #101
- Decorators having
IEnumerable<TDecoratee>
dependency were not handled correctly.