I have a class with a constructor that looks like this:
public TimedWorker(int timerInterval, Action execute, ILogger logger)
I am using the Castle Windsor fluent configuration and whilst the config below works, I am concerned about the way I am resolving Action. Is there a better way so that I am not always resolving the action delegate to the same thing?
Component
.For<IWorker>()
.ImplementedBy<TimedWorker>()
.DependsOn(new { timerInterval = TimerInterval })
.LifeStyle.Transient,
Component.For<Action>()
.Instance(() => Resolve<SomeService>().SomeMethod())
.LifeStyle.Transient,
Component.For<ILogger>()
.ImplementedBy<TraceLogProvider>()
.LifeStyle.Singleton