I have written a custom SessionStoreProvider class that inherits from the SessionStateStoreProviderBase. I have a class called SessionStore that serves a a Data Access Layer for the database I am using as the backend to store the session data. I've created a singleton instance property like below
public static SessionStore Instance
{
get
{
if (instance == null)
{
lock (syncRoot)
{
if (instance == null)
instance = new SessionStore();
}
}
return instance;
}
}
Back inside my SessionStoreProvider methods I am instantiating the class like so
var sessionStore = SessionStore.Instance;
My goal is to make sure that only one session store exists for a user session at one time. Is this a sound approach? Would this have any negative repercussions? Is there a better way to do this?