Example #1
0
        /// <summary>
        ///     Virtual Dispose method.
        /// </summary>
        /// <param name="disposing">
        ///     Whether this was called from Dispose of the Finalizer.
        /// </param>
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                /////
                // If called by the finalizer, dont bother restoring the context as you
                // are currently running on a GC Finalizer thread.
                /////
                if (disposing)
                {
                    /////
                    // Restore the original request context
                    /////
                    if ((_originalContextData != null) && (_originalContextData.IsValid))
                    {
                        RequestContext.SetContext(_originalContextData);
                    }
                    else
                    {
                        RequestContext.FreeContext( );
                    }
                }

                _originalContextData = null;

                /////
                // Dispose complete.
                /////
                disposed = true;
            }
        }
Example #2
0
 /// <summary>
 ///     Initializes a new instance of the CustomContext class.
 /// </summary>
 /// <param name="contextData">
 ///     Context data.
 /// </param>
 public CustomContext(RequestContextData contextData)
     : base(() => RequestContext.SetContext(contextData))
 {
 }
Example #3
0
 /// <summary>
 ///     Initializes a new instance of the CustomContext class.
 /// </summary>
 /// <param name="context">
 ///     Context.
 /// </param>
 public CustomContext(RequestContext context)
     : base(() => RequestContext.SetContext(context))
 {
 }
Example #4
0
 /// <summary>
 ///     Initializes a new instance of the CustomContext class.
 /// </summary>
 /// <param name="identity">
 ///     Identity info.
 /// </param>
 /// <param name="tenant">
 ///     Tenant info.
 /// </param>
 /// <param name="culture">
 ///     Culture name.
 /// </param>
 public CustomContext(IdentityInfo identity, TenantInfo tenant, string culture)
     : base(() => RequestContext.SetContext(identity, tenant, culture))
 {
 }