I find myself building an application that uses around 10 Web References in various controls throughout my umbraco installation. They way I currently have my application set up is that I have stored the authentication credentials in my web config, and then instantiate the connection to the webservice every time I need to make a query.
Is there a way I can instantiate these webservice queries at application start, and then reuse them as necessary? I am partially concerned with performance, and partially concerned with having duplicate code creating these connections all over the place.
Instantiating Application Level Objects
Hey,
I find myself building an application that uses around 10 Web References in various controls throughout my umbraco installation. They way I currently have my application set up is that I have stored the authentication credentials in my web config, and then instantiate the connection to the webservice every time I need to make a query.
Is there a way I can instantiate these webservice queries at application start, and then reuse them as necessary? I am partially concerned with performance, and partially concerned with having duplicate code creating these connections all over the place.
I am running Umbraco 4.0.x on IIS7.
Thanks,
-Ben
Ben,
See my blogpost on integrating log4net you could use same principle to wire up your webservices.
Regards
Ismail
This seems a little invasive, as you have to remove a delivered DLL. Is there a way to do this without modifying the core application?
You're basically wanting dependency injection. I use Autofac (http://code.google.com/p/autofac/) for DI in projects (including Umbraco).
Google has plenty of good articles which can get you started with DI.
is working on a reply...