Hi,

I need to override one service for the scope of a resolve operation.
Like this:

ISession session = ...// get NH session from some tricky place
var pbs = container.Resolve<IPermissionsBuilderService>(new
{session});

Impl of IPBS depends on ISession and on IAuthorizationRepository (also
depends on ISession).

The desired behavior would be resolving IPBS with the provided session
in the IAuthorizationRepository as well.

What happens with build from master:
ISession dependency is successfully resolved (via
AdditionalParameters)
IAuthorizationRepository cannot be resolved. I debugged into the
sources and it seems that the reason lives in the method
RebuildContextForParameter in DefaultDependencyResolver. If True was
passed to the CreationContext constructor, everything would work. IMO
it is a bug.
Any considerations why is it False?

private CreationContext RebuildContextForParameter(CreationContext
current, Type parameterType)
{
        if (parameterType.ContainsGenericParameters)
        {
                return current;
        }

        return new CreationContext(parameterType, current, false);
}

Thanks,
Vadim

P.S. Worked around by creating a child container. Though I believe
it's a bug anyway.

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Development List" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-devel?hl=en.

Reply via email to