BUG: ObjectFactory.With().EqualTo().GetAllInstances<>() ignores the args

24 views
Skip to first unread message

Tom McKearney

unread,
Feb 14, 2012, 2:49:24 PM2/14/12
to structuremap-users
I have this call here:

ObjectFactory
.With("source")
.EqualTo(sourceName)
.GetAllInstances<ITraceContextMessageProcessor>();

I know "sourceName" is set, yet I get the exception:

"StructureMap Exception Code: 205
Missing requested Instance property "source" for InstanceKey ..."

After looking through the code, I noticed that I got to here in the
class "ExplicitArguments":


public void RegisterDefaults(BuildSession session)
{
foreach (var pair in _children)
{
session.RegisterDefault(pair.Key, pair.Value);
}
}

The problem is that the ["source" => sourceName] mapping is stored in
the member variable "_args", which is not accessed here at all.

Is there another way I can make this work?

Tom
Reply all
Reply to author
Forward
0 new messages