> Ok, but I want that the persistence class works on other envirnoments, not > only web. For now, I can use a test on null to HttpContext.Current, to > determine if I am in a web app.
It sounds like we are working on the same problem. I want to have a singleton that can allow access to a transaction shared between class instances without them knowing about it. I have considered the HttpContext.Current test also. But then I think that if HttpContext.Current uses CallContext, why not use that. The best answer is that the classes in the remoting namespaces are probably going to change. FWIW, I am using exploring this for SnapDAL at sourceforge. The thread local storage will (read may) be used to share transactions, but the first purpose is to aid unit testing of classes that explicitly setup their own connections. SnapDAL caches instances of IDbCommand that are served our for calls. For a test, I substitute a mock object by putting it this thread local storage. The cache looks there first, before looking in it's static cache. In that way other callers would still get the real SqlCommand or whatever, but the code under test would get a mock object (from DotNetMock) which can then be grabbed to use for all the useful features DotNetMock provides. This code is in cvs only for a little while longer, a c# rewrite of the original vb version. I want to get this question answered before I do a release. ===== Philip - http://blogs.xcskiwinn.org/panmanphil "There's a difference between righteous anger and just being crabby" - Barbara =================================== This list is hosted by DevelopMentor� http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com
