CallContext.LogicalGetData Vs. CallContext.GetData

后端 未结 2 1020
北海茫月
北海茫月 2021-01-31 14:30

The CallContext API has LogicalGetData & GetData, but the MSDN Documentation doesn\'t do much to explain the difference between the tw

2条回答
  •  遇见更好的自我
    2021-01-31 15:08

    It appears that this is a subtle difference related to method calls made remotely to another AppDomain. In this instance a LogicalCallContext is created and the data is stored in a manner accessible to LogicalGetData. While in normal, non-remoted method calls the data is stored in a manner accessible to GetData.

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

    GetData:

    Retrieves an object with the specified name from the CallContext.

    LogicalGetData:

    Retrieves an object with the specified name from the logical call context.

提交回复
热议问题