Say I have the following class
MyComponent : IMyComponent {
public MyComponent(int start_at) {...}
}
I can register an instance of it wit
You could use a configuration class to read the app.config. Then register that and get windsor to use it for its dependency. Ideally my MyConfiguration would use an interface.
public class MyConfiguration
{
public long CacheSize { get; }
public MyConfiguration()
{
CacheSize = ConfigurationManager.AppSettings["cachesize"].ToLong();
}
}
container.Register(Component.For().ImplementedBy());
container.Register(Component.For>()
.ImplementedBy>().
DependsOn(Dependency.OnValue("size", container.Resolve().CacheSize))
.LifestyleSingleton());