I have a WPF app which, when it starts, looks at the file system for some config files
For each config file it finds, it displays some info in a different window
Each window has an associated ViewModel object which is bound to the windows datacontext
So a new ViewModel is created for each config file. An object representing the data in the config file is passed into the viewmodels constructor
However, the View model also has other dependancies passed into the constructor
The code looks something like this (in a bootstrapper initiated from app.xaml)
foreach (WindowConfig config in ConfigManager.GetConfigs())
{
IMyService svc = new MyService();
//change to resolve from IoC container
MyViewModel vm = new MyViewModel(config, svc);
Window1 view = new Window1();
view.DataContext = vm;
window.show();
}
I want to use Castle IoC contaoiner resolve these dependancies. I know how to do that for IMyService, but how can I do it for the specific class that has been created from the config file ?
thanks