Share via


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 建立通道時建立。

屬性

Next

取得或設定通道接收提供者鏈結中的下一個接收提供者。

方法

CreateSink(IChannelSender, String, Object)

建立接收鏈結。

適用於