IServerChannelSinkProvider 接口

定义

为远程处理消息从其流过的服务器信道创建服务器信道接收器。

public interface class IServerChannelSinkProvider
public interface IServerChannelSinkProvider
[System.Runtime.InteropServices.ComVisible(true)]
public interface IServerChannelSinkProvider
type IServerChannelSinkProvider = interface
[<System.Runtime.InteropServices.ComVisible(true)>]
type IServerChannelSinkProvider = interface
Public Interface IServerChannelSinkProvider
派生
属性

示例

下面的代码示例演示了此接口的实现。

[System::Security::Permissions::PermissionSet(System::Security::
   Permissions::SecurityAction::Demand, Name = "FullTrust")]
public ref class ServerSinkProvider: public IServerChannelSinkProvider
{
   // The next provider in the chain.
private:
   IServerChannelSinkProvider^ nextProvider;

public:
   property IServerChannelSinkProvider^ Next 
   {
      virtual IServerChannelSinkProvider^ get()
      {
         return (nextProvider);
      }

      virtual void set( IServerChannelSinkProvider^ value )
      {
         nextProvider = value;
      }
   }

   virtual IServerChannelSink^ CreateSink( IChannelReceiver^ channel )
   {
      Console::WriteLine( "Creating ServerSink" );

      // Create the next sink in the chain.
      IServerChannelSink^ nextSink = nextProvider->CreateSink( channel );

      // Hook our sink up to it.
      return (gcnew ServerSink( nextSink ));
   }

   virtual void GetChannelData( IChannelDataStore^ /*channelData*/ ){}

   // This constructor is required in order to use the provider in file-based configuration.
   // It need not do anything unless you want to use the information in the parameters.
   ServerSinkProvider( IDictionary^ /*properties*/, ICollection^ /*providerData*/ ){}
};
public class ServerSinkProvider : IServerChannelSinkProvider
{

    // The next provider in the chain.
    private IServerChannelSinkProvider nextProvider;

    public IServerChannelSinkProvider Next
    {
        get
        {
            return(nextProvider);
        }
        set
        {
            nextProvider = value;
        }
    }

    public IServerChannelSink CreateSink (IChannelReceiver channel)
    {
        Console.WriteLine("Creating ServerSink");

        // Create the next sink in the chain.
        IServerChannelSink nextSink = nextProvider.CreateSink(channel);

        // Hook our sink up to it.
        return( new ServerSink(nextSink) );
    }

    public void GetChannelData (IChannelDataStore channelData) {}

    // This constructor is required in order to use the provider in file-based configuration.
    // It need not do anything unless you want to use the information in the parameters.
    public ServerSinkProvider (IDictionary properties, ICollection providerData) {}
}

有关相应服务器接收器实现的示例, IServerChannelSink 请参阅接口文档。

注解

通道接收器通过 接口的 IServerChannelSinkProvider 实现连接到服务器通道。 所有远程处理服务器通道都提供采用 IServerChannelSinkProvider 作为参数的构造函数。

通道接收器提供程序存储在一个链中,用户负责将所有通道接收器提供程序链接在一起,然后再将外部通道接收器提供程序传递给通道构造函数。 IServerChannelSinkProvider 提供一个为此目的调用 Next 的属性。

在配置文件中指定多个通道接收器提供程序时,远程处理基础结构将按照它们在配置文件中找到的顺序将它们链接在一起。 在调用期间 RemotingConfiguration.Configure ,通道接收器提供程序与通道同时创建。

IMethodCallMessage生成 后,.NET Framework搜索已注册通道的列表,以查找可以处理呼叫的通道。 找到适当的通道后,将从通道中检索通道接收器,并将 IMethodCallMessage 转发到接收器进行处理。

属性

Next

获取或设置信道接收器提供程序链中的下一个接收器提供程序。

方法

CreateSink(IChannelReceiver)

创建接收器链。

GetChannelData(IChannelDataStore)

返回与当前接收器关联的信道的信道数据。

适用于