Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

ILogicalThreadAffinative Interface

Marks an object that can propagate outside of an AppDomain in a LogicalCallContext.

Namespace:  System.Runtime.Remoting.Messaging
Assembly:  mscorlib (in mscorlib.dll)
[ComVisibleAttribute(true)]
public interface ILogicalThreadAffinative

When a remote method call is made to an object in another AppDomain, the current CallContext class generates a LogicalCallContext that travels along with the call to the remote location. Only objects that expose the ILogicalThreadAffinative interface and are stored in the CallContext are propagated outside the AppDomain. Objects that do not support this interface are not transmitted in LogicalCallContext instances with remote method calls.

The following code example demonstrates the use of the ILogicalThreadAffinative interface to transmit Principal and Identity Objects to a remote location for identification. To view the code for the HelloServiceClass class used in the sample, see the example for the GetData method. To view the code for the server class used in this sample, see example for the RegisterActivatedServiceType class. To view the code for the client class used in the sample, see the example for the CallContext class.


[Serializable]
public class LogicalCallContextData : ILogicalThreadAffinative
{
   int _nAccesses;
   IPrincipal _principal;

   public string numOfAccesses {
      get {
         return String.Format("The identity of {0} has been accessed {1} times.", 
                              _principal.Identity.Name, 
                              _nAccesses);
      }
   }

   public IPrincipal Principal {
      get { 
         _nAccesses ++;
         return _principal;
      }
   }

   public LogicalCallContextData(IPrincipal p) {
      _nAccesses = 0;
      _principal = p;
   }
}


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.