共用方式為


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)

傳回與目前接收相關聯通道的通道資料。

適用於