What is the major use of MarshalByRefObject?

后端 未结 4 972
野性不改
野性不改 2020-12-07 13:13

What\'s the purpose for MarshalByRefObject?

4条回答
  •  温柔的废话
    2020-12-07 13:39

    Another important use of MarshalByRefObject is for implementing AOP via remoting sink-chains.

    If you have an object that derives from ContextBoundObject (which itself derives from MarshalByRefObject) you can instantiate it in a separate Context within the same AppDomain and have communications between objects automatically go through the Remoting proxy system - allowing you to plug custom sinks into the Remoting sink-chain.

    This ultimately allows you to 'decorate' method calls to your objects and implement cross-cutting services, such as logging and security etc.

提交回复
热议问题