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

BuildUp with ExplicitArguments #510

Open
dubray opened this issue Sep 29, 2016 · 1 comment
Open

BuildUp with ExplicitArguments #510

dubray opened this issue Sep 29, 2016 · 1 comment

Comments

@dubray
Copy link

dubray commented Sep 29, 2016

I'm looking for an overload of Container.BuildUp(),

Container.BuildUp(object target, ExplicitArguments args)

To avoid using Container.Configure() calls

I've glanced at the code of BuildSession and its BuildUp() implementation:

public void BuildUp(object target)
        {
            if (target == null) throw new ArgumentNullException("target");

            var pluggedType = target.GetType();

            var plan = _pipelineGraph.Policies.ToBuildUpPlan(pluggedType, () =>
            {
                return _pipelineGraph.Instances.GetDefault(pluggedType) as IConfiguredInstance ?? new ConfiguredInstance(pluggedType);
            });

            plan.BuildUp(this, this, target);
        }

Is it a matter of calling

_sessionCache.GetDefault(pluggedType, _pipelineGraph); 

Before

_pipelineGraph.Instances.GetDefault(pluggedType) as IConfiguredInstance ?? new ConfiguredInstance(pluggedType);

and using the cached value instead?

Any suggestion on how to go about this?

@jeremydmiller
Copy link
Contributor

Sorry, I let this one get by me. You should be able to get away with just adding defaults to the session cache before you call plan.BuildUp

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

No branches or pull requests

2 participants