Muokkaa

Jaa


IServerChannelSinkProvider Interface

Definition

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
Derived
Attributes

Examples

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
    {
        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) {}
}

See the IServerChannelSink interface documentation for an example of the corresponding server sink implementation.

Remarks

Channel sinks are connected to a server channel through implementations of the IServerChannelSinkProvider interface. All 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. 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. The channel sink providers are created at the same time as the channel, during a RemotingConfiguration.Configure call.

After the IMethodCallMessage is generated, .NET Framework searches through the list of registered channels to find one that can process the call. 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.

Properties

Next

Gets or sets the next sink provider in the channel sink provider chain.

Methods

CreateSink(IChannelReceiver)

Creates a sink chain.

GetChannelData(IChannelDataStore)

Returns the channel data for the channel that the current sink is associated with.

Applies to