on application start
I have a WCF service and use Spring.ServiceModel.Activation.ServiceHostFactory as a factory in my *.svc. What I need is to load some data into cache when service is called first time or restarted.
Could you please suggest a best way to do so?
Right now I inherited from the Spring.ServiceModel.Activation.ServiceHostFactory and put my code there but probably should be a better way? Tnx in advance.
Where are you hosting the WCF service? Inside IIS? Since you can perform DI on the WCF service, you can inject it with a reference to a DataCache class of some kind. I've usually seen subclassing Spring's ServiceHostFactory when additional behaviors needed to be added progammatically to the host but I guess it could also be used for this bootstrapping purpose. In this case I guess you expose the cache via some static accessor methods? DI would be more elegant.