IMethodMessage.LogicalCallContext 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
현재 메서드 호출에 대한 LogicalCallContext를 가져옵니다.
public:
property System::Runtime::Remoting::Messaging::LogicalCallContext ^ LogicalCallContext { System::Runtime::Remoting::Messaging::LogicalCallContext ^ get(); };
public System.Runtime.Remoting.Messaging.LogicalCallContext LogicalCallContext { get; }
public System.Runtime.Remoting.Messaging.LogicalCallContext LogicalCallContext { [System.Security.SecurityCritical] get; }
member this.LogicalCallContext : System.Runtime.Remoting.Messaging.LogicalCallContext
[<get: System.Security.SecurityCritical>]
member this.LogicalCallContext : System.Runtime.Remoting.Messaging.LogicalCallContext
Public ReadOnly Property LogicalCallContext As LogicalCallContext
속성 값
현재 메서드 호출에 대한 LogicalCallContext를 가져옵니다.
- 특성
예외
직접 실행 호출자가 인터페이스에 대한 참조를 통해 호출하며 인프라 권한이 없는 경우
예제
다음 예제 코드를 사용 하는 방법을 보여 줍니다는 LogicalCallContext
논리 스레드에 연결 된 값 여부를 결정 하는 속성입니다.
//This sample requires full trust
[PermissionSetAttribute(SecurityAction::Demand, Name = "FullTrust")]
public ref class MyProxy: public RealProxy
{
private:
String^ stringUri;
MarshalByRefObject^ targetObject;
public:
MyProxy( Type^ type )
: RealProxy( type )
{
targetObject = dynamic_cast<MarshalByRefObject^>(Activator::CreateInstance( type ));
ObjRef^ myObject = RemotingServices::Marshal( targetObject );
stringUri = myObject->URI;
}
MyProxy( Type^ type, MarshalByRefObject^ targetObject )
: RealProxy( type )
{
this->targetObject = targetObject;
}
virtual IMessage^ Invoke( IMessage^ message ) override
{
message->Properties[ "__Uri" ] = stringUri;
IMethodMessage^ myMethodMessage = dynamic_cast<IMethodMessage^>(ChannelServices::SyncDispatchMessage( message ));
Console::WriteLine( "---------IMethodMessage* example-------" );
Console::WriteLine( "Method name : {0}", myMethodMessage->MethodName );
Console::WriteLine( "LogicalCallContext has information : {0}", myMethodMessage->LogicalCallContext->HasInfo );
Console::WriteLine( "Uri : {0}", myMethodMessage->Uri );
return myMethodMessage;
}
};
public class MyProxy : RealProxy
{
String stringUri;
MarshalByRefObject targetObject;
public MyProxy(Type type) : base(type)
{
targetObject = (MarshalByRefObject)Activator.CreateInstance(type);
ObjRef myObject = RemotingServices.Marshal(targetObject);
stringUri = myObject.URI;
}
public MyProxy(Type type, MarshalByRefObject targetObject) : base(type)
{
this.targetObject = targetObject;
}
public override IMessage Invoke(IMessage message)
{
message.Properties["__Uri"] = stringUri;
IMethodMessage myMethodMessage =
(IMethodMessage)ChannelServices.SyncDispatchMessage(message);
Console.WriteLine("---------IMethodMessage example-------");
Console.WriteLine("Method name : " + myMethodMessage.MethodName);
Console.WriteLine("LogicalCallContext has information : " +
myMethodMessage.LogicalCallContext.HasInfo);
Console.WriteLine("Uri : " + myMethodMessage.Uri);
return myMethodMessage;
}
}
Public Class MyProxy
Inherits RealProxy
Private stringUri As String
Private targetObject As MarshalByRefObject
<SecurityPermission(SecurityAction.LinkDemand)> _
Public Sub New(type As Type)
MyBase.New(type)
targetObject = CType(Activator.CreateInstance(type), MarshalByRefObject)
Dim myObject As ObjRef = RemotingServices.Marshal(targetObject)
stringUri = myObject.URI
End Sub
<SecurityPermission(SecurityAction.LinkDemand)> _
Public Sub New(type As Type, targetObject As MarshalByRefObject)
MyBase.New(type)
Me.targetObject = targetObject
End Sub
<SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags:=SecurityPermissionFlag.Infrastructure)> _
Public Overrides Function Invoke(message As IMessage) As IMessage
message.Properties("__Uri") = stringUri
Dim myMethodMessage As IMethodMessage = _
CType(ChannelServices.SyncDispatchMessage(message), IMethodMessage)
Console.WriteLine("---------IMethodMessage example-------")
Console.WriteLine("Method name : " + myMethodMessage.MethodName)
Console.WriteLine("LogicalCallContext has information : " + _
myMethodMessage.LogicalCallContext.HasInfo.ToString())
Console.WriteLine("Uri : " + myMethodMessage.Uri)
Return myMethodMessage
End Function 'Invoke
End Class