grumpydev/TinyIoC — Issue #15: AsPerRequestSingleton() looses parameters
Author: sloncho
Created: 2012-01-19 15:31:28+00:00
State: open

Hi,
I have a type registration done like this:

ioc.Register().AsPerRequestSingleton();

Then I use it like this:

var parameters = new NamedParameterOverloads()
{
{"param1", this.TinyIoCContainer },
{"param2", param2Object}
};

This fails to resolve. I started to debug, and tracked the problem to CustomObjectLifetimeFactory.GetObject. The ctor parameters are passed to this method, but as this is the first time create such an object, it goes through if(current == null), and then it calls current = container.ConstructType, where it does not pass the parameters down the road. So it tries to construct TinyIoCContainer, and fails, as it looks like its not self-registered.

Anyway, even if TiNyIoCContainer were self-registered, this is wrong behavior, as it's not going to populate the parameter I'm passing.

This is the version from the latest NuGet.

I read the code in GitHub, and even if it has changed, still the call to container.ConstructType does not carry over the parameters, so most probably the problem is still there.

Does it look like a bug?