We need you! We're working hard on the next version of Developer Fusion -
Let us know what you think we should be up to!
-
Expand
Microsoft.Win32
-
Expand
Microsoft.Win32.SafeHandles
-
Expand
System
-
Expand
System.Runtime.Hosting
-
Expand
System.Runtime.InteropServices
-
Expand
System.Runtime.CompilerServices
-
Expand
System.Collections
-
Expand
System.Collections.Generic
-
Expand
System.Collections.ObjectModel
-
Expand
System.Configuration.Assemblies
-
Expand
System.Diagnostics
-
Expand
System.Diagnostics.CodeAnalysis
-
Expand
System.Diagnostics.SymbolStore
-
Expand
System.Globalization
-
Expand
System.IO
-
Expand
System.IO.IsolatedStorage
-
Expand
System.Reflection
-
Expand
System.Reflection.Cache
-
Expand
System.Reflection.Emit
-
Expand
System.Resources
-
Expand
System.Runtime
-
Expand
System.Runtime.InteropServices.Expando
-
Expand
System.Runtime.ConstrainedExecution
-
Expand
System.Runtime.Remoting.Activation
-
Expand
System.Runtime.Remoting.Messaging
-
Expand
System.Runtime.Remoting.Channels
-
Expand
System.Runtime.Remoting.Lifetime
-
Expand
System.Runtime.Remoting
-
Expand
System.Runtime.Remoting.Contexts
-
Expand
ArrayWithSize
-
Expand
AsyncReplySink
-
Expand
CallBackHelper
-
Expand
Context
-
AddDynamicProperty(Context, IDynamicProperty)
-
AddGlobalDynamicProperty(IDynamicProperty)
-
AddPerContextDynamicProperty(IDynamicProperty)
-
AllocateDataSlot()
-
AllocateNamedDataSlot(string)
-
AppDomain()
-
CheckPropertyNameClash(string, IContextProperty, int)
-
CleanupInternalContext()
-
Context()
-
Context(int)
-
ContextID()
-
ContextProperties()
-
CreateDefaultContext()
-
CreateEnvoyChain(MarshalByRefObject)
-
CreateServerObjectChain(MarshalByRefObject)
-
DefaultContext()
-
DoCallBack(CrossContextDelegate)
-
DoCallBackFromEE(IntPtr, IntPtr, int)
-
DoCallBackGeneric(IntPtr, CrossContextDelegate)
-
DynamicSinks()
-
ExecuteCallBackInEE(IntPtr)
-
FreeNamedDataSlot(string)
-
Freeze()
-
GetClientContextChain()
-
GetData(LocalDataStoreSlot)
-
GetNamedDataSlot(string)
-
GetProperty(string)
-
GetServerContextChain()
-
GlobalDynamicSinks()
-
GrowPropertiesArray(IContextProperty)
-
InternalContextID()
-
InternalFreeze()
-
IsDefaultContext()
-
IsThreadPoolAware()
-
MyLocalStore()
-
NotifyActivatorProperties(IMessage, bool)
-
NotifyDynamicSinks(IMessage, bool, bool, bool, bool)
-
PerContextDynamicProperties()
-
RegisterDynamicProperty(IDynamicProperty, ContextBoundObject, Context)
-
RemoveDynamicProperty(Context, string)
-
RemoveGlobalDynamicProperty(string)
-
RemovePerContextDynamicProperty(string)
-
ReserveSlot()
-
SetData(LocalDataStoreSlot, object)
-
SetProperty(IContextProperty)
-
SetThreadPoolAware()
-
SetupInternalContext(bool)
-
ToString()
-
UnregisterDynamicProperty(string, ContextBoundObject, Context)
-
Expand
ContextAttribute
-
Expand
ContextProperty
-
Expand
DynamicPropertyHolder
-
Expand
IContextAttribute
-
Expand
IContextProperty
-
Expand
IContextPropertyActivator
-
Expand
IContributeClientContextSink
-
Expand
IContributeDynamicSink
-
Expand
IContributeEnvoySink
-
Expand
IContributeObjectSink
-
Expand
IContributeServerContextSink
-
Expand
IDynamicMessageSink
-
Expand
IDynamicProperty
-
Expand
SynchronizationAttribute
-
Expand
SynchronizedClientContextSink
-
Expand
SynchronizedServerContextSink
-
Expand
WorkItem
-
Expand
System.Runtime.Remoting.Proxies
-
Expand
System.Runtime.Remoting.Metadata
-
Expand
System.Runtime.Remoting.Metadata.W3cXsd2001
-
Expand
System.Runtime.Remoting.Services
-
Expand
System.Runtime.Serialization
-
Expand
System.Runtime.Serialization.Formatters
-
Expand
System.Runtime.Serialization.Formatters.Binary
-
Expand
System.Runtime.Versioning
-
Expand
System.Security
-
Expand
System.Security.Cryptography
-
Expand
System.Security.Cryptography.X509Certificates
-
Expand
System.Security.Permissions
-
Expand
System.Security.Policy
-
Expand
System.Security.Principal
-
Expand
System.Security.Util
-
Expand
System.Text
-
Expand
System.Threading
-
Expand
System.Runtime.Remoting.Channels.Http
-
Expand
System.Runtime.Remoting.Channels.Tcp
-
Expand
System.Runtime.Remoting.MetadataServices
-
Expand
System.Runtime.Serialization.Formatters.Soap.Xml
-
Expand
System.Runtime.Serialization.Formatters.Soap
-
Expand
Microsoft.Tools.Caspol
-
Expand
Microsoft.Tools.Build
-
Expand
Microsoft.CSharp
-
Expand
System.CodeDom
-
Expand
System.CodeDom.Compiler
-
Expand
System.Collections.Specialized
-
Expand
System.ComponentModel
-
Expand
System.ComponentModel.Design
-
Expand
System.ComponentModel.Design.Serialization
-
Expand
System.Configuration
-
Expand
System.Web
-
Expand
System.Configuration.Provider
-
Expand
System.Configuration.Internal
-
Expand
System.Internal
-
Expand
System.Windows.Forms
-
Expand
System.Net
-
Expand
System.Net.Sockets
-
Expand
System.Net.NetworkInformation
-
Expand
System.Net.ComImports
-
Expand
System.Net.Security
-
Expand
System.Net.Cache
-
Expand
System.Net.Configuration
-
Expand
System.Text.RegularExpressions
-
Expand
System.Tools
-
Expand
System.IO.Compression
-
Expand
System.IO.Ports
-
Expand
System.Security.AccessControl
-
Expand
System.Xml
-
Expand
System.Xml.XPath.DataBinding
-
Expand
System.Xml.Schema
-
Expand
System.Xml.Serialization
-
Expand
System.Xml.Serialization.Advanced
-
Expand
System.Xml.Serialization.Configuration
-
Expand
System.Xml.XPath
-
Expand
System.Xml.Xsl
-
Expand
System.Xml.Xsl.IlGen
-
Expand
System.Xml.Xsl.Qil
-
Expand
System.Xml.Xsl.Runtime
-
Expand
System.Xml.Xsl.XPath
-
Expand
System.Xml.Xsl.Xslt
-
Expand
System.Xml.Xsl.XsltOld
-
Expand
System.Xml.Xsl.XsltOld.Debugger
-
Expand
Microsoft.JScript
-
Expand
Microsoft.Vsa
-
Expand
Microsoft.JScript.Vsa
- namespace System.Runtime.Remoting.Contexts
- {
-
- using System;
- using System.Security;
- using System.Security.Permissions;
- using System.Threading;
- using System.Runtime.InteropServices;
- using System.Runtime.Remoting;
- using System.Runtime.Remoting.Activation;
- using System.Runtime.Remoting.Messaging;
- using System.Runtime.Serialization;
- using System.Runtime.CompilerServices;
- using System.Globalization;
-
-
-
-
-
-
- /// <internalonly/>
- [System.Runtime.InteropServices.ComVisible(true)]
- public delegate void CrossContextDelegate();
-
- /// <internalonly/>
-
-
- [System.Runtime.InteropServices.ComVisible(true)]
- public class Context
- {
-
-
- internal const int CTX_DEFAULT_CONTEXT = 1;
-
-
- internal const int CTX_FROZEN = 2;
-
-
-
-
-
- internal const int CTX_THREADPOOL_AWARE = 4;
-
- private const int GROW_BY = 8;
- private const int STATICS_BUCKET_SIZE = 8;
-
- private IContextProperty[] _ctxProps;
-
- private DynamicPropertyHolder _dphCtx;
-
- private LocalDataStore _localDataStore;
- private IMessageSink _serverContextChain;
- private IMessageSink _clientContextChain;
- private AppDomain _appDomain;
-
- private object[] _ctxStatics;
-
-
-
- private IntPtr _internalContext;
-
-
-
- private int _ctxID;
- private int _ctxFlags;
- private int _numCtxProps;
-
-
- private int _ctxStaticsCurrentBucket;
- private int _ctxStaticsFreeIndex;
-
-
- private static DynamicPropertyHolder _dphGlobal = new DynamicPropertyHolder();
-
-
- private static LocalDataStoreMgr _localDataStoreMgr = new LocalDataStoreMgr();
-
-
- private static int _ctxIDCounter = 0;
-
- /// <internalonly/>
- [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
- public Context() : this(0)
- {
- }
-
- private Context(int flags)
- {
-
- _ctxFlags = flags;
- if ((_ctxFlags & CTX_DEFAULT_CONTEXT) != 0) {
- _ctxID = 0;
-
- }
- else {
- _ctxID = Interlocked.Increment(ref _ctxIDCounter);
- }
-
-
-
-
- DomainSpecificRemotingData data = Thread.GetDomain().RemotingData;
- if (null != data) {
- IContextProperty[] ctxProps = data.AppDomainContextProperties;
- if (null != ctxProps) {
- for (int i = 0; i < ctxProps.Length; i++) {
- SetProperty(ctxProps[i]);
- }
- }
- }
-
-
- if ((_ctxFlags & CTX_DEFAULT_CONTEXT) != 0) {
- this.Freeze();
- }
-
-
-
-
- SetupInternalContext((_ctxFlags & CTX_DEFAULT_CONTEXT) == CTX_DEFAULT_CONTEXT);
-
- Message.DebugOut("Creating Context with ID " + _ctxID + " and flags " + flags + " " + Environment.NewLine);
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern void SetupInternalContext(bool bDefault);
-
- /// <internalonly/>
- ~Context()
- {
-
-
-
- if (_internalContext != IntPtr.Zero && (_ctxFlags & CTX_DEFAULT_CONTEXT) == 0) {
- CleanupInternalContext();
- }
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern void CleanupInternalContext();
-
- /// <internalonly/>
- public virtual Int32 ContextID {
- [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
- get { return _ctxID; }
- }
-
- internal virtual IntPtr InternalContextID {
- get { return _internalContext; }
- }
-
- internal virtual AppDomain AppDomain {
- get { return _appDomain; }
- }
-
- internal bool IsDefaultContext {
- get { return _ctxID == 0; }
- }
-
- /// <internalonly/>
- public static Context DefaultContext {
- [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
- get { return Thread.GetDomain().GetDefaultContext(); }
- }
-
- static internal Context CreateDefaultContext()
- {
- return new Context(CTX_DEFAULT_CONTEXT);
- }
-
- /// <internalonly/>
- [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
- public virtual IContextProperty GetProperty(string name)
- {
- if (_ctxProps == null || name == null) {
- return null;
- }
- IContextProperty prop = null;
- for (int i = 0; i < _numCtxProps; i++) {
- if (_ctxProps[i].Name.Equals(name)) {
- prop = _ctxProps[i];
- break;
- }
- }
- return prop;
- }
-
- /// <internalonly/>
- [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
- public virtual void SetProperty(IContextProperty prop)
- {
-
-
-
-
- if (prop == null || prop.Name == null) {
- throw new ArgumentNullException((prop == null) ? "prop" : "property name");
- }
-
- if ((_ctxFlags & CTX_FROZEN) != 0) {
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_AddContextFrozen"));
- }
-
- lock (this) {
-
- CheckPropertyNameClash(prop.Name, _ctxProps, _numCtxProps);
-
-
- if (_ctxProps == null || _numCtxProps == _ctxProps.Length) {
- _ctxProps = GrowPropertiesArray(_ctxProps);
- }
-
- _ctxProps[_numCtxProps++] = prop;
- }
- }
-
- internal virtual void InternalFreeze()
- {
- _ctxFlags |= CTX_FROZEN;
-
-
- for (int i = 0; i < _numCtxProps; i++) {
- _ctxProps[i].Freeze(this);
- }
-
- }
- /// <internalonly/>
- [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
- public virtual void Freeze()
- {
- lock (this) {
- if ((_ctxFlags & CTX_FROZEN) != 0) {
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ContextAlreadyFrozen"));
- }
- InternalFreeze();
- }
- }
-
- internal virtual void SetThreadPoolAware()
- {
-
- BCLDebug.Assert((_ctxFlags & CTX_DEFAULT_CONTEXT) == 0, "This operation is not allowed on the default context!");
- _ctxFlags |= CTX_THREADPOOL_AWARE;
- }
-
- internal virtual bool IsThreadPoolAware {
- get { return (_ctxFlags & CTX_THREADPOOL_AWARE) == CTX_THREADPOOL_AWARE; }
- }
-
- /// <internalonly/>
- public virtual IContextProperty[] ContextProperties {
-
-
- [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
- get {
- if (_ctxProps == null) {
- return null;
- }
- lock (this) {
- IContextProperty[] retProps = new IContextProperty[_numCtxProps];
- Array.Copy(_ctxProps, retProps, _numCtxProps);
- return retProps;
- }
- }
- }
-
- static internal void CheckPropertyNameClash(string name, IContextProperty[] props, int count)
- {
- for (int i = 0; i < count; i++) {
- if (props[i].Name.Equals(name)) {
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_DuplicatePropertyName"));
- }
- }
- }
-
- static internal IContextProperty[] GrowPropertiesArray(IContextProperty[] props)
- {
-
- int newSize = (props != null ? props.Length : 0) + GROW_BY;
- IContextProperty[] newProps = new IContextProperty[newSize];
- if (props != null) {
-
- Array.Copy(props, newProps, props.Length);
- }
- return newProps;
- }
-
- internal virtual IMessageSink GetServerContextChain()
- {
- if (_serverContextChain == null) {
-
- IMessageSink newServerContextChain = ServerContextTerminatorSink.MessageSink;
-
-
- object prop = null;
- int iSink = _numCtxProps;
- while (iSink-- > 0) {
-
-
- prop = _ctxProps[iSink];
- IContributeServerContextSink sink = prop as IContributeServerContextSink;
- if (null != sink) {
-
- newServerContextChain = sink.GetServerContextSink(newServerContextChain);
- if (newServerContextChain == null) {
- throw new RemotingException(Environment.GetResourceString("Remoting_Contexts_BadProperty"));
- }
- }
- }
- lock (this) {
- if (_serverContextChain == null) {
- _serverContextChain = newServerContextChain;
- }
- }
- }
- return _serverContextChain;
- }
-
- internal virtual IMessageSink GetClientContextChain()
- {
- Message.DebugOut("Context::GetClientContextChain: IN _ctxID =" + _ctxID + Environment.NewLine);
- if (_clientContextChain == null) {
- Message.DebugOut("Context::GetClientContextChain: _clientContextChain == null, creating chain" + Environment.NewLine);
-
- IMessageSink newClientContextChain = ClientContextTerminatorSink.MessageSink;
-
-
-
-
-
-
- object prop = null;
- int iSink = 0;
- while (iSink < _numCtxProps) {
- Message.DebugOut("Context::GetClientContextChain: checking property " + _ctxProps[iSink].Name + Environment.NewLine);
-
-
- prop = _ctxProps[iSink];
- IContributeClientContextSink sink = prop as IContributeClientContextSink;
- if (null != sink) {
- Message.DebugOut("Context::GetClientContextChain: calling GetClientContextSink on " + _ctxProps[iSink].Name + Environment.NewLine);
-
- newClientContextChain = sink.GetClientContextSink(newClientContextChain);
- if (newClientContextChain == null) {
- throw new RemotingException(Environment.GetResourceString("Remoting_Contexts_BadProperty"));
- }
- }
- iSink++;
- }
-
- lock (this) {
- if (_clientContextChain == null) {
- _clientContextChain = newClientContextChain;
- }
-
- }
- }
- return _clientContextChain;
- }
-
- internal virtual IMessageSink CreateServerObjectChain(MarshalByRefObject serverObj)
- {
-
- IMessageSink serverObjectChain = new ServerObjectTerminatorSink(serverObj);
-
-
- object prop = null;
- int iSink = _numCtxProps;
- while (iSink-- > 0) {
-
-
- prop = _ctxProps[iSink];
- IContributeObjectSink sink = prop as IContributeObjectSink;
- if (null != sink) {
-
- serverObjectChain = sink.GetObjectSink(serverObj, serverObjectChain);
- if (serverObjectChain == null) {
- throw new RemotingException(Environment.GetResourceString("Remoting_Contexts_BadProperty"));
- }
- }
- }
- return serverObjectChain;
- }
-
- internal virtual IMessageSink CreateEnvoyChain(MarshalByRefObject objectOrProxy)
- {
-
- IMessageSink envoyChain = EnvoyTerminatorSink.MessageSink;
-
-
-
-
- object prop = null;
- int iSink = 0;
-
- MarshalByRefObject exposedObj = objectOrProxy;
-
- while (iSink < _numCtxProps) {
-
-
- prop = _ctxProps[iSink];
- IContributeEnvoySink sink = prop as IContributeEnvoySink;
- if (null != sink) {
-
- envoyChain = sink.GetEnvoySink(exposedObj, envoyChain);
- if (envoyChain == null) {
- throw new RemotingException(Environment.GetResourceString("Remoting_Contexts_BadProperty"));
- }
- }
- iSink++;
- }
- return envoyChain;
- }
-
-
-
-
-
- internal IMessage NotifyActivatorProperties(IMessage msg, bool bServerSide)
- {
- BCLDebug.Assert((msg is IConstructionCallMessage) || (msg is IConstructionReturnMessage), "Bad activation msg type");
- BCLDebug.Assert(!((msg is IConstructionCallMessage) && (msg is IConstructionReturnMessage)), "Activation message cannot be both call & return type");
-
- BCLDebug.Assert((_ctxFlags & CTX_FROZEN) == CTX_FROZEN, "ServerContext not frozen during activation!");
-
-
-
-
- IMessage errMsg = null;
-
- try {
-
-
- int iProp = _numCtxProps;
- object prop = null;
-
- while (iProp-- != 0) {
-
- prop = _ctxProps[iProp];
- IContextPropertyActivator activator = prop as IContextPropertyActivator;
- if (null != activator) {
-
- IConstructionCallMessage ccm = msg as IConstructionCallMessage;
- if (null != ccm) {
-
- if (!bServerSide) {
-
- activator.CollectFromClientContext(ccm);
- }
- else {
- activator.DeliverClientContextToServerContext(ccm);
- }
- }
- else {
-
- if (bServerSide) {
-
- activator.CollectFromServerContext((IConstructionReturnMessage)msg);
- }
- else {
-
- activator.DeliverServerContextToClientContext((IConstructionReturnMessage)msg);
- }
- }
- }
- }
- }
- catch (Exception e) {
- IMethodCallMessage mcm = null;
- if (msg is IConstructionCallMessage) {
- mcm = (IMethodCallMessage)msg;
- }
- else {
- mcm = new ErrorMessage();
- }
- errMsg = new ReturnMessage(e, mcm);
- if (msg != null) {
- ((ReturnMessage)errMsg).SetLogicalCallContext((LogicalCallContext)msg.Properties[Message.CallContextKey]);
- }
- }
- return errMsg;
- }
-
- /// <internalonly/>
- public override string ToString()
- {
- return "ContextID: " + _ctxID;
- }
-
-
-
-
-
-
-
- /// <internalonly/>
- [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
- public void DoCallBack(CrossContextDelegate deleg)
- {
-
-
-
- if (deleg == null) {
- throw new ArgumentNullException("deleg");
- }
-
- if ((_ctxFlags & CTX_FROZEN) == 0) {
- throw new RemotingException(Environment.GetResourceString("Remoting_Contexts_ContextNotFrozenForCallBack"));
- }
-
- Context currCtx = Thread.CurrentContext;
- if (currCtx == this) {
-
-
-
-
- deleg();
- }
- else {
-
- currCtx.DoCallBackGeneric(this.InternalContextID, deleg);
- GC.KeepAlive(this);
- }
- }
-
-
-
-
- static internal void DoCallBackFromEE(IntPtr targetCtxID, IntPtr privateData, int targetDomainID)
- {
- BCLDebug.Assert(targetCtxID != IntPtr.Zero, "Bad transition context");
-
-
-
-
- if (targetDomainID == 0) {
- CallBackHelper cb = new CallBackHelper(privateData, true, targetDomainID);
- CrossContextDelegate ctxDel = new CrossContextDelegate(cb.Func);
- Thread.CurrentContext.DoCallBackGeneric(targetCtxID, ctxDel);
- }
- else {
-
-
-
- TransitionCall msgCall = new TransitionCall(targetCtxID, privateData, targetDomainID);
-
- Message.PropagateCallContextFromThreadToMessage(msgCall);
-
- IMessage retMsg = Thread.CurrentContext.GetClientContextChain().SyncProcessMessage(msgCall);
- Message.PropagateCallContextFromMessageToThread(retMsg);
-
- IMethodReturnMessage msg = retMsg as IMethodReturnMessage;
- if (null != msg) {
- if (msg.Exception != null)
- throw msg.Exception;
- }
- }
- }
-
-
- internal void DoCallBackGeneric(IntPtr targetCtxID, CrossContextDelegate deleg)
- {
- TransitionCall msgCall = new TransitionCall(targetCtxID, deleg);
-
- Message.PropagateCallContextFromThreadToMessage(msgCall);
-
- IMessage retMsg = this.GetClientContextChain().SyncProcessMessage(msgCall);
- if (null != retMsg) {
- Message.PropagateCallContextFromMessageToThread(retMsg);
- }
-
- IMethodReturnMessage msg = retMsg as IMethodReturnMessage;
- if (null != msg) {
- if (msg.Exception != null)
- throw msg.Exception;
- }
-
- }
-
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- static internal extern void ExecuteCallBackInEE(IntPtr privateData);
-
-
-
-
-
- private LocalDataStore MyLocalStore {
- get {
- if (_localDataStore == null) {
-
-
- lock (_localDataStoreMgr) {
- if (_localDataStore == null) {
-
- _localDataStore = _localDataStoreMgr.CreateLocalDataStore();
- }
- }
- }
- return _localDataStore;
- }
- }
-
-
-
- /// <internalonly/>
- [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
- public static LocalDataStoreSlot AllocateDataSlot()
- {
- return _localDataStoreMgr.AllocateDataSlot();
- }
- /// <internalonly/>
- [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
- public static LocalDataStoreSlot AllocateNamedDataSlot(string name)
- {
- return _localDataStoreMgr.AllocateNamedDataSlot(name);
- }
- /// <internalonly/>
- [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
- public static LocalDataStoreSlot GetNamedDataSlot(string name)
- {
- return _localDataStoreMgr.GetNamedDataSlot(name);
- }
- /// <internalonly/>
- [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
- public static void FreeNamedDataSlot(string name)
- {
- _localDataStoreMgr.FreeNamedDataSlot(name);
- }
-
- /// <internalonly/>
- [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
- public static void SetData(LocalDataStoreSlot slot, object data)
- {
- Thread.CurrentContext.MyLocalStore.SetData(slot, data);
- }
-
- /// <internalonly/>
- [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
- public static object GetData(LocalDataStoreSlot slot)
- {
- return Thread.CurrentContext.MyLocalStore.GetData(slot);
- }
-
-
-
-
- private int ReserveSlot()
- {
-
-
- if (_ctxStatics == null) {
-
- _ctxStatics = new object[STATICS_BUCKET_SIZE];
-
- _ctxStatics[0] = null;
- _ctxStaticsFreeIndex = 1;
- _ctxStaticsCurrentBucket = 0;
- }
-
-
- if (_ctxStaticsFreeIndex == STATICS_BUCKET_SIZE) {
- object[] newBucket = new object[STATICS_BUCKET_SIZE];
-
-
- object[] bucket = _ctxStatics;
- while (bucket[0] != null) {
- bucket = (object[])bucket[0];
- }
-
- bucket[0] = newBucket;
- _ctxStaticsFreeIndex = 1;
- _ctxStaticsCurrentBucket++;
- }
-
-
- return _ctxStaticsFreeIndex++ | _ctxStaticsCurrentBucket << 16;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- /// <internalonly/>
- [SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.Infrastructure)]
- public static bool RegisterDynamicProperty(IDynamicProperty prop, ContextBoundObject obj, Context ctx)
- {
- bool fRegistered = false;
-
- if (prop == null || prop.Name == null || !(prop is IContributeDynamicSink)) {
- throw new ArgumentNullException("prop");
- }
- if (obj != null && ctx != null) {
-
- throw new ArgumentException(Environment.GetResourceString("Argument_NonNullObjAndCtx"));
- }
- if (obj != null) {
-
- fRegistered = IdentityHolder.AddDynamicProperty(obj, prop);
- }
- else {
-
- fRegistered = Context.AddDynamicProperty(ctx, prop);
-