BaseChannelSinkWithProperties クラス
プロパティにディクショナリ インターフェイスを公開する、チャネル シンクの基本の実装を提供します。
この型のすべてのメンバの一覧については、BaseChannelSinkWithProperties メンバ を参照してください。
System.Object
System.Runtime.Remoting.Channels.BaseChannelObjectWithProperties
System.Runtime.Remoting.Channels.BaseChannelSinkWithProperties
MustInherit Public Class BaseChannelSinkWithProperties
Inherits BaseChannelObjectWithProperties
[C#]
public abstract class BaseChannelSinkWithProperties :
BaseChannelObjectWithProperties
[C++]
public __gc __abstract class BaseChannelSinkWithProperties : public
BaseChannelObjectWithProperties
[JScript]
public abstract class BaseChannelSinkWithProperties extends
BaseChannelObjectWithProperties
スレッドセーフ
この型の public static (Visual Basicでは Shared) のすべてのメンバは、マルチスレッド操作で安全に使用できます。インスタンスのメンバの場合は、スレッドセーフであるとは限りません。
解説
チャネル シンクは、そのチャネルを流れている基になるメッセージにアクセスできるようにするプラグイン ポイント、およびリモート オブジェクトにメッセージを送信するためにトランスポート機構が使用するストリームを提供します。チャネル シンクは互いにリンクされてチャネル シンク プロバイダのチェインとなり、すべてのチャネル メッセージはこのシンク チェインを流れた後で、メッセージがシリアル化されて転送されます。
メモ このクラスは、リンク確認要求と継承確認要求をクラス レベルで行います。直前の呼び出し元または派生クラスにインフラストラクチャ アクセス許可がない場合、 SecurityException がスローされます。セキュリティ要求の詳細については、「 リンク確認要求 」および「 継承確認要求 」を参照してください。
継承時の注意: BaseChannelSinkWithProperties から継承する場合は、 Keys プロパティと Item プロパティを実装する必要があります。
使用例
Friend Class MyClientFormatterChannelSink
Inherits BaseChannelSinkWithProperties
Implements IClientChannelSink, IMessageSink
Private nextClientSink As IClientChannelSink = Nothing
Private nextMessageSink As IMessageSink = Nothing
Public Sub New(nextSink As IClientChannelSink, nextMsgSink As IMessageSink)
MyBase.New()
nextClientSink = nextSink
nextMessageSink = nextMsgSink
End Sub 'New
Public Sub ProcessMessage(msg As IMessage, requestHeaders As ITransportHeaders, _
requestStream As Stream, ByRef responseHeaders As ITransportHeaders, _
ByRef responseStream As Stream) _
Implements IClientChannelSink.ProcessMessage
nextClientSink.ProcessMessage(msg, requestHeaders, requestStream, _
responseHeaders, responseStream)
End Sub 'ProcessMessage
Public Sub AsyncProcessRequest(sinkStack As IClientChannelSinkStack, _
msg As IMessage, headers As ITransportHeaders, myStream As Stream) _
Implements IClientChannelSink.AsyncProcessRequest
sinkStack.Push(Me, Nothing)
nextClientSink.AsyncProcessRequest(sinkStack, msg, headers, myStream)
End Sub 'AsyncProcessRequest
Public Sub AsyncProcessResponse(sinkStack As IClientResponseChannelSinkStack, _
state As Object, headers As ITransportHeaders, myStream As Stream) _
Implements IClientChannelSink.AsyncProcessResponse
sinkStack.AsyncProcessResponse(headers, myStream)
End Sub 'AsyncProcessResponse
Public Function GetRequestStream(msg As IMessage, headers As ITransportHeaders) As Stream _
Implements IClientChannelSink.GetRequestStream
Return Nothing
End Function 'GetRequestStream
Public ReadOnly Property NextChannelSink() As IClientChannelSink _
Implements IClientChannelSink.NextChannelSink
Get
Return nextClientSink
End Get
End Property
Public ReadOnly Property NextSink() As IMessageSink _
Implements IMessageSink.NextSink
Get
Return nextMessageSink
End Get
End Property
Public Overrides ReadOnly Property Properties() As Collections.IDictionary _
Implements IClientChannelSink.Properties
Get
End Get
End Property
Public Function AsyncProcessMessage(msg As IMessage, replySink As IMessageSink) As IMessageCtrl _
Implements IMessageSink.AsyncProcessMessage
Return Nothing
End Function 'AsyncProcessMessage
Public Function SyncProcessMessage(msg As IMessage) As IMessage _
Implements IMessageSink.SyncProcessMessage
Return nextMessageSink.SyncProcessMessage(msg)
End Function 'SyncProcessMessage
Default Public Overrides Property Item(key As Object) As Object
Get
If key Is GetType(MyKey) Then
Return Me
End If
Return Nothing
End Get
Set
Throw New NotSupportedException()
End Set
End Property
Public Overrides ReadOnly Property Keys() As ICollection
Get
Dim myKeys As New ArrayList(0)
myKeys.Add(GetType(MyKey))
Return myKeys
End Get
End Property
End Class 'MyClientFormatterChannelSink
Public Class MyKey
End Class 'MyKey
[C#]
internal class MyClientFormatterChannelSink :
BaseChannelSinkWithProperties, IClientChannelSink, IMessageSink
{
private IClientChannelSink nextClientSink=null;
private IMessageSink nextMessageSink = null;
public MyClientFormatterChannelSink(IClientChannelSink nextSink,
IMessageSink nextMsgSink) : base()
{
nextClientSink = nextSink;
nextMessageSink = nextMsgSink;
}
public void ProcessMessage(IMessage msg,
ITransportHeaders requestHeaders, Stream requestStream,
out ITransportHeaders responseHeaders, out Stream responseStream)
{
nextClientSink.ProcessMessage(msg, requestHeaders, requestStream,
out responseHeaders, out responseStream);
}
public void AsyncProcessRequest(IClientChannelSinkStack sinkStack,
IMessage msg, ITransportHeaders headers, Stream myStream)
{
sinkStack.Push(this, null);
nextClientSink.AsyncProcessRequest(sinkStack,msg,headers,myStream);
}
public void AsyncProcessResponse(IClientResponseChannelSinkStack sinkStack,
Object state, ITransportHeaders headers, Stream myStream)
{
sinkStack.AsyncProcessResponse(headers, myStream);
}
public Stream GetRequestStream(IMessage msg,ITransportHeaders headers)
{
return null;
}
public IClientChannelSink NextChannelSink
{
get
{
return nextClientSink;
}
}
public IMessageSink NextSink
{
get
{
return nextMessageSink;
}
}
public IMessageCtrl AsyncProcessMessage(IMessage msg,
IMessageSink replySink)
{
return null;
}
public IMessage SyncProcessMessage(IMessage msg)
{
return nextMessageSink.SyncProcessMessage(msg);
}
public override Object this[Object key]
{
get
{
if (key == typeof(MyKey))
return this;
return null;
}
set
{
throw new NotSupportedException();
}
}
public override ICollection Keys
{
get
{
ArrayList myKeys = new ArrayList(1);
myKeys.Add(typeof(MyKey));
return myKeys;
}
}
}
public class MyKey
{
}
[C++]
private __gc class MyClientFormatterChannelSink :
public BaseChannelSinkWithProperties, public IClientChannelSink, public IMessageSink
{
private:
IClientChannelSink* nextClientSink;
IMessageSink* nextMessageSink;
public:
MyClientFormatterChannelSink() : nextClientSink(0), nextMessageSink(0) {}
MyClientFormatterChannelSink(IClientChannelSink* nextSink,
IMessageSink* nextMsgSink) : BaseChannelSinkWithProperties()
{
nextClientSink = nextSink;
nextMessageSink = nextMsgSink;
}
void ProcessMessage(IMessage* msg,
ITransportHeaders* requestHeaders, Stream* requestStream,
[Out]ITransportHeaders** responseHeaders, [Out]Stream** responseStream)
{
nextClientSink->ProcessMessage(msg, requestHeaders, requestStream,
responseHeaders, responseStream);
}
void AsyncProcessRequest(IClientChannelSinkStack* sinkStack,
IMessage* msg, ITransportHeaders* headers, Stream* myStream)
{
sinkStack->Push(this, 0);
nextClientSink->AsyncProcessRequest(sinkStack,msg,headers,myStream);
}
void AsyncProcessResponse(IClientResponseChannelSinkStack* sinkStack,
Object* state, ITransportHeaders* headers, Stream* myStream)
{
sinkStack->AsyncProcessResponse(headers, myStream);
}
Stream* GetRequestStream(IMessage* msg,ITransportHeaders* headers)
{
return 0;
}
__property IClientChannelSink* get_NextChannelSink()
{
return nextClientSink;
}
__property IMessageSink* get_NextSink()
{
return nextMessageSink;
}
IMessageCtrl* AsyncProcessMessage(IMessage* msg,
IMessageSink* replySink)
{
return 0;
}
IMessage* SyncProcessMessage(IMessage* msg)
{
return nextMessageSink->SyncProcessMessage(msg);
}
__property Object* get_Item( Object* key )
{
if (key == __typeof(MyKey))
return this;
return 0;
}
__property void set_Item( Object* value, Object* key )
{
throw new NotSupportedException();
}
__property ICollection* get_Keys()
{
ArrayList* myKeys = new ArrayList(1);
myKeys->Add(__typeof(MyKey));
return myKeys;
}
};
public __gc class MyClientFormatterProvider : public IClientChannelSinkProvider
{
private:
IClientChannelSinkProvider* nextProvider;
public:
MyClientFormatterProvider() : nextProvider(0)
{
}
IClientChannelSink* CreateSink(IChannelSender* channel,
String* myUrl, Object* remoteChannelData)
{
IClientChannelSink* nextSink = 0;
IMessageSink* nextMsgSink = 0;
if (nextProvider!=0)
{
Console::WriteLine(S"Next client sink provider is: {0}", nextProvider);
// Create a sink chain calling the next sink provider's
// 'CreateSink' method.
nextSink=nextProvider->CreateSink(channel,myUrl,remoteChannelData);
nextMsgSink=dynamic_cast<IMessageSink*>(nextSink);
}
return new MyClientFormatterChannelSink(nextSink,nextMsgSink);
}
__property IClientChannelSinkProvider* get_Next()
{
return nextProvider;
}
__property void set_Next( IClientChannelSinkProvider* value )
{
nextProvider = value;
}
};
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
名前空間: System.Runtime.Remoting.Channels
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
アセンブリ: Mscorlib (Mscorlib.dll 内)
.NET Framework セキュリティ:
- SecurityPermission (インフラストラクチャ コードを操作するために必要なアクセス許可) 要求値: SecurityAction.LinkDemand; アクセス許可値: SecurityPermissionFlag.Infrastructure
- SecurityPermission (インフラストラクチャ コードを操作するために必要なアクセス許可) 要求値: SecurityAction.InheritanceDemand; アクセス許可値: SecurityPermissionFlag.Infrastructure
参照
BaseChannelSinkWithProperties メンバ | System.Runtime.Remoting.Channels 名前空間