Resolve( string name )

Mar 24, 2008 at 1:40 PM
Edited Mar 24, 2008 at 2:16 PM

I'm currently trying to resolve the following object:
NamedObjectConfigurator configurator = container.Resolve<NamedObjectConfigurator>( "StaticNamedObject" );

NamedObjectConfigurator has the following signature:
public NamedObjectConfigurator( INamedObjectConfiguration configuration )

In my test, if I use the following:
INamedObjectConfiguration test = container.Resolve<INamedObjectConfiguration>( "StaticNamedObject" );

Then I get the expected implementation of INamedObjectConfiguration. However, resolving NamedObjectConfigurator with the name of "StaticNamedObject" returns a NamedObjectConfigurator with a INamedObjectConfiguration implementation that is reserved for a NULL buildkey. It's as if the buildKeyName is not being passed through. I'm trying to find out where in the callstack that this dependency gets resolved, but I can't seem to find this. Is there a way to turn off the DynamicBuildPlan functionality for the sake of debugging? :)

Does the build key name get passed along when dependencies are resolved? Or do I have this all backwards?


- Edit: -
I just confirmed that I get expected functionality if I force things like this:
public NamedObjectConfigurator( 
			[Dependency( "StaticNamedObject" )]
			INamedObjectConfiguration configuration )
However, I then obviously miss out on the default (null key) dependencies. So it appears that build key names are not "passed through" for dependency resolution. I guess I have a broken way of looking at things. :)
Mar 24, 2008 at 7:15 PM
Ok, this is really dumb and I wish CodePlex would allow you to delete discussions. :|

My container did not have a NamedObjectConfigurator instance registered with the "StaticNamedObject" name, so it was returning the default instance. Dur.