Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AsPerRequestSingleton() looses parameters #15

Open
sloncho opened this issue Jan 19, 2012 · 0 comments
Open

AsPerRequestSingleton() looses parameters #15

sloncho opened this issue Jan 19, 2012 · 0 comments

Comments

@sloncho
Copy link

sloncho commented Jan 19, 2012

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant