語言

IClientChannelSinkProvider 介面

定義

為客戶端通道建立用戶端通道匯入,讓遠端訊息會透過此通道流動。

public interface class IClientChannelSinkProvider
public interface IClientChannelSinkProvider
[System.Runtime.InteropServices.ComVisible(true)]
public interface IClientChannelSinkProvider
type IClientChannelSinkProvider = interface
[<System.Runtime.InteropServices.ComVisible(true)>]
type IClientChannelSinkProvider = interface
Public Interface IClientChannelSinkProvider
衍生
屬性

範例

以下程式碼範例說明此介面的實作。

[System::Security::Permissions::PermissionSet(System::Security::
   Permissions::SecurityAction::Demand, Name = "FullTrust")]
public ref class ClientSinkProvider: public IClientChannelSinkProvider
{
private:

   // The next provider in the chain.
   IClientChannelSinkProvider^ nextProvider;

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

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

   virtual IClientChannelSink^ CreateSink( IChannelSender^ channel, String^ url, Object^ remoteChannelData )
   {
      Console::WriteLine( "Creating ClientSink for {0}", url );
      
      // Create the next sink in the chain.
      IClientChannelSink^ nextSink = nextProvider->CreateSink( channel, url, remoteChannelData );
      
      // Hook our sink up to it.
      return (gcnew ClientSink( nextSink ));
   }

   // 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.
   ClientSinkProvider( IDictionary^ /*properties*/, ICollection^ /*providerData*/ ){}
};
public class ClientSinkProvider : IClientChannelSinkProvider
{

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

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

    public IClientChannelSink CreateSink (IChannelSender channel, String url, Object remoteChannelData)
    {

        Console.WriteLine("Creating ClientSink for {0}", url);

        // Create the next sink in the chain.
        IClientChannelSink nextSink = nextProvider.CreateSink(channel, url, remoteChannelData);

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

    // 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 ClientSinkProvider (IDictionary properties, ICollection providerData) {}
}

請參閱 IClientChannelSink 介面文件,了解對應的用戶端匯實作範例。

備註

通道匯透過介面的實作 IClientChannelSinkProvider 連接到用戶端通道。 所有遠端用戶端通道都提供以 為 IClientChannelSinkProvider 參數的建構子。

通道匯供應商以鏈狀儲存,使用者負責將所有通道匯流提供者串接在一起,然後再將外層提供者交給通道建構器。 IClientChannelSinkProvider 提供一個為此目的所命名 Next 的性質。

當設定檔中指定多個通道匯流提供者時,遠端基礎設施會依照設定檔中找到的順序將它們串接在一起。 頻道匯流供應商會在通話中 RemotingConfiguration.Configure 頻道建立時建立。

屬性

名稱 Description
Next

接收或設定通道匯供應商鏈中的下一個匯供應商。

方法

名稱 Description
CreateSink(IChannelSender, String, Object)

形成一個水槽鏈。

適用於