Question

I have simple win service, that executes few tasks periodically. How should I pass Ninject kernel to all my task classes?

Is it good idea to create static variable of base task class and initialize it on service start?

Was it helpful?

Solution

Rather than a static variable on the base task class, I would favor injecting the kernel into each class instance. This provides a bit more flexibility should you ever decide that you need more than one kernel (for whatever reason). The static variable in the base class just seems yucky, for lack of a better term.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top