IServerChannelSinkProvider 接口

定义

为远程处理消息从其流过的服务器信道创建服务器信道接收器。Creates server channel sinks for the server channel through which remoting messages flow.

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
派生
属性

示例

下面的代码示例演示了此接口的实现。The following code example illustrates an implementation of this interface.

[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
    {
        [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
        get
        {
            return(nextProvider);
        }
        [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
        set
        {
            nextProvider = value;
        }
    }

    [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
    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) );
    }

    [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
    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有关相应的服务器接收器实现的示例,请参阅接口文档。See the IServerChannelSink interface documentation for an example of the corresponding server sink implementation.

注解

通道接收器通过接口的实现连接到服务器通道 IServerChannelSinkProviderChannel sinks are connected to a server channel through implementations of the IServerChannelSinkProvider interface. 所有远程处理服务器通道均提供采用作为参数的构造函数 IServerChannelSinkProviderAll the remoting server channels provide constructors that take a IServerChannelSinkProvider as a parameter.

信道接收器提供程序存储在链中,用户负责将所有通道接收器提供程序链接在一起,然后将外部通道传递给通道构造函数。Channel sink providers are stored in a chain, and the user is responsible for chaining all channel sink providers together before passing the outer one to the channel constructor. IServerChannelSinkProviderNext为此目的提供一个名为的属性。IServerChannelSinkProvider provides a property called Next for this purpose.

当在配置文件中指定多个信道接收器提供程序时,远程处理基础结构将按照它们在配置文件中的找到顺序将它们链接在一起。When multiple channel sink providers are specified in a configuration file, the remoting infrastructure will chain them together in the order they are found in the configuration file. 信道接收器提供程序在调用期间与通道同时创建 RemotingConfiguration.ConfigureThe channel sink providers are created at the same time as the channel, during a RemotingConfiguration.Configure call.

生成后 IMethodCallMessage ,.NET Framework 搜索已注册通道的列表,查找可处理调用的通道。After the IMethodCallMessage is generated, .NET Framework searches through the list of registered channels to find one that can process the call. 找到适当的通道后,将从通道检索通道接收器,并将 IMethodCallMessage 转发到接收器进行处理。Once an appropriate channel has been found, the channel sink is retrieved from the channel, and the IMethodCallMessage is forwarded to the sink for processing.

属性

Next

获取或设置信道接收器提供程序链中的下一个接收器提供程序。Gets or sets the next sink provider in the channel sink provider chain.

方法

CreateSink(IChannelReceiver)

创建接收器链。Creates a sink chain.

GetChannelData(IChannelDataStore)

返回与当前接收器关联的信道的信道数据。Returns the channel data for the channel that the current sink is associated with.

适用于