I host the service on a windows service.
The following snippet creates an instance of the ServiceHost object:
Host = new ServiceHost(typeof(Services.DocumentInfoService));
The DocumentInfoService class implements a contract interface in which there are methods that call business objects that require initialization (in fact, a connection string). Ideally, I would like the hosting process to get the connection string from the configuration file and pass it to the constructor for my DocumentInfoService service object, which will hold it and use it to transfer business objects as needed.
However, the ServiceHost constructor accepts a System.Type object, so instances of DocumentInfoService are created using the default constructor. I noticed that there is another constructor method for ServiceHost that accepts an instance of an object, but the docs indicate what to use with single points.
Is there a way to get to my object after building it so that I can pass some initialization data to it?
source share