I have created an instance of TCP listener (network socket) as a TopShelf Windows service. Since this project is a service with Main() and not a class library, I’m not certain how to create a constructor that will permit me to inject a callback.
Specifically, the idea is that when the TCP listener receives a message, it should invoke the injected callback method. Normally with a class library I would create a constructor taking as argument ICallback and instantiate accordingly.
Can I perform constructor injection with my TopShelf service? If so, how?
With something like this: