public static IDisposable Initialize(ThreadDataManagerData parentThreadData) { if (parentThreadData != null) { parentThreadData.CheckNotDisposed(); } return(new ThreadDataManagerScope(new ThreadDataManagerData(parentThreadData), true)); }
public ThreadDataManagerScope(ThreadDataManagerData newCurrentData, bool disposeData) { Verify.ArgumentNotNull(newCurrentData, "newCurrentData"); newCurrentData.CheckNotDisposed(); _threadData = newCurrentData; // NOTE: We shouldn't take value from 'Current' property, since it may return it from HttpContext _threadDataValueToBeRestored = _threadDataManagerData; _threadDataManagerData = newCurrentData; _disposeData = disposeData; }
public static ThreadDataManagerData GetCurrentNotNull() { ThreadDataManagerData current = Current; Verify.That(current != null, @"ThreadDataManager hasn't been initialized in the current thread. You probably have forgotten to use Composite.Core.Threading.ThreadDataManager.EnsureInitialize() call on a custom created thread. Example of usage: using(Composite.Core.Threading.ThreadDataManager.EnsureInitialize()) { // Code that works with C1 data layer goes here ..... }"); current.CheckNotDisposed(); return(current); }
public ThreadDataManagerScope(ThreadDataManagerData newCurrentData, bool disposeData) { Verify.ArgumentNotNull(newCurrentData, "newCurrentData"); newCurrentData.CheckNotDisposed(); _threadData = newCurrentData; // NOTE: We shouldn't take value from 'Current' property, since it may return it from HttpContext _threadDataValueToBeRestored = _threadDataManagerData; _threadDataManagerData = newCurrentData; _disposeData = disposeData; }
public static IDisposable Initialize(ThreadDataManagerData parentThreadData) { if(parentThreadData != null) { parentThreadData.CheckNotDisposed(); } return new ThreadDataManagerScope(new ThreadDataManagerData(parentThreadData), true); }