The following code is for demo purposes only.
Lets say i have 2 components (businessService, and dataService), and a UI class.
UI class needs a busi
The behavior you see is by design.
There are a couple of ways to approach the problem, depending on how dynamic the value you want to pass down is.
The documentation does a pretty good job detailing it, so I won't reiterate that here.
Update
To clarity - Windsor does not pass inline arguments down the resolution pipeline. The reason for that is simple - doing so would break an abstraction. Calling code would have to implicitly know that your BusinessService
depends on DataService
which depends on connection string.
If you absolutely have to do it, than do make this explicit. That is do pretty much what you're doing - resolve the DataService
with its dependency on connection string explicitly, and explicitly resolve BusinessService
passing the DataService
as dependency.
To make things really explicit (and nicer to use as well) I'd suggest using Typed Factory for that instead of directly calling the container
public interface IFactory
{
IDataService ResolveDataService(string connectionString);
IBussinessService ResolveBussinessService(IDataService dataService);
// possibly release method for IBussinessService as well
}