I'm creating a WCF Host application. My Service class is defined as PerSession something like this:
[ServiceBehavior(InstanceContextMode=InstanceContextMode.PerSession)]
public class CalculatorService : ICalculatorInstance
{
//...
}
I assume that means that everytime a new session is created an new instance of the CalculatorService class will be instantiated. However if I have a common dependency that all the instance will depend upon, what is the best way to pass that dependecy to all the instances?
The ServiceHost
class does not seem to have anyway to pass a "state" object to all the instances? Is there another way without using static variables or singletons?