I am using Castle Windosr container. I want to be able to specify some constructor dependencies at runtime which you can obviously do by using a Resolve overload that takes a dictionary, all good and fine. However if I want to specify runtime dependency for a dependency of the root then I'm lost, at the moment I've worked around by explicitly creating each and bedding it in. Essentially its a decorator scenario and I want to get an instance of the decarator whilst providing a dependency at runtime for the object under decoration. Any ideas? I'd rather not have to do what I'm doing below and I'd rather not have the decarator constructor populate the object underneath since there will be times when the dependencies are not the same.
public static IActivity GetActivityFromIoC(string key, Message message, Audit audit)
{
IActivity activity = IoC.Resolve<IActivity>(key, new Dictionary<
string, object>(){
{ "message", message }
});
IActivity auditingActivity = IoC.Resolve<IActivity>("auditing.activity", new Dictionary<
string, object>(){
{ "activity", activity },
{ "message", message },
{ "audit", audit }
});
return auditingActivity;
}