示例#1
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    if (oldValue != null)
                    {
#if (SILVERLIGHT)
                        current = (ChannelCreationScope)oldValue;
#else
                        CallContext.LogicalSetData(CallContextKey, oldValue);
#endif
                    }
                    else
                    {
#if (SILVERLIGHT)
                        current = null;
#else
                        CallContext.FreeNamedDataSlot(CallContextKey);
#endif
                    }
                }
                // Cleanup native resources here!
                _disposed = true;
            }
        }
示例#2
0
        public ChannelCreationScope(object proxy)
        {
#if (SILVERLIGHT)
            oldValue = current;
#else
            oldValue = CallContext.LogicalGetData(CallContextKey);
#endif
            this.Proxy = proxy;

#if (SILVERLIGHT)
            current = this;
#else
            CallContext.LogicalSetData(CallContextKey, this);
#endif
        }