ILoggable

A place to keep my thoughts on programming

June 15, 2006 .net

ThreadSingleton revisited

I’ve been using the CallContext for a while now to create thread singletons, especially under ASP.NET since it’s a single process and you need to work in a thread context when dealing with per request singletons.

Today a co-worker pointed out this post. Apparently you can’t trust CallContext under ASP.NET. You really should stuff your singletons into HttpContext when running under ASP.NET, just to be sure. It’s a good read.

Leave a comment