z4kn4fein/stashbox

Please restore ResolutionContext.GetDependencyOverrideOrDefault in v5.0.0

schuettecarsten opened this issue · 1 comments

In v5.0.0, the method ResolutionContext.GetDependencyOverrideOrDefault was removed. I use this method in my code to make sure that a specific value was passed into the Resolve call and not created by the Container itself. So, I kindly ask you to restore that functionality.

Sample:

	var tenant = context.GetDependencyOverrideOrDefault<AadTenant>();
	if (tenant == null)
	{
		throw new InvalidOperationException("AAD tenant entity should be passed into the resolver as dependency override!");
	}

I found the new method GetExpressionOverrideOrDefault, but I am usure if I can use this to query an ConstantExpression and use the Value? Is that a valid workaround?

Ok, I just found out that IResolutionContext was renamed to IRequestContext.