Monday, June 16, 2008

Global Services in WCSF

I have been using the different software factories released from the P&P team for around 2 years. Even we used the old versions for the VS 2005 to be run under VS 2008 till now!

As we decided to embrace the software factories in implementing our projects, we are using the WCSF for one of the currently running projects.

One of the design goals for the WCSF is to allow cooperating modules to contribute and use shared infrastructure components. So, we had many common infrastructure services like navigation and session store components added to the services root container.

Last week we ran in a situation where our QAs reported a bug related to session data overlapping between different users! Some developers started to blame the underlying session module in the ASP.NET :). After we did some investigation, it appeared that our session store service had private variables that cache the data retrieved from the session (to minimize the casting for the stored objects) and those variables are shared across all the requests. Why? These global services are singletons. So, from design and implementation point of view, avoid sharing a state in those services (i.e. do not declare member variables).

No comments: