ActionMessageFilter.Match 方法
定义
测试消息或缓冲消息是否与为筛选器配置的操作之一相匹配。Tests whether a message or a buffered message matches one of the actions configured for the filter.
重载
| Match(Message) |
测试消息的操作是否与此 ActionMessageFilter 中指定的操作之一相匹配。Tests whether a message's action matches one of the actions specified in this ActionMessageFilter. |
| Match(MessageBuffer) |
测试缓冲消息的操作标头是否与此 ActionMessageFilter 中指定的操作之一相匹配。Tests whether a buffered message's action header matches one of the actions specified in this ActionMessageFilter. |
注解
两种重载之间的区别是,一种重载使用 Message 参数,但无法检查消息正文;另一个重载使用 MessageBuffer 参数,可以检查消息的任何部分。The difference between the two overloads is that one takes a Message parameter and cannot examine the message body; the other takes a MessageBuffer parameter and can examine any part of the message. 由于操作筛选器不检查正文,所以这些方法是等效的。Because an action filter does not examine the body, these methods are equivalent.
如果必须要利用多个 ActionMessageFilter 对象检查消息,则请将筛选器放置到 IMessageFilterTable<TFilterData> 中,然后使用表提供的匹配功能。If you must check the message against multiple ActionMessageFilter objects, put the filters into an IMessageFilterTable<TFilterData> and then use the matching functionality provided by the table.
Match(Message)
测试消息的操作是否与此 ActionMessageFilter 中指定的操作之一相匹配。Tests whether a message's action matches one of the actions specified in this ActionMessageFilter.
public:
override bool Match(System::ServiceModel::Channels::Message ^ message);
public override bool Match (System.ServiceModel.Channels.Message message);
override this.Match : System.ServiceModel.Channels.Message -> bool
Public Overrides Function Match (message As Message) As Boolean
参数
返回
如果 Message 操作标头与指定的操作之一相匹配,则为 true;否则为 false。true if the Message action header matches one of the specified actions; otherwise, false.
例外
message 为 null。message is null.
注解
如果必须利用单个筛选器中的操作来测试消息,并且 Match 可用,则请使用 Message 的此重载。Use this overload of Match when a message must be tested against the actions in a single filter and the Message is available.
适用于
Match(MessageBuffer)
测试缓冲消息的操作标头是否与此 ActionMessageFilter 中指定的操作之一相匹配。Tests whether a buffered message's action header matches one of the actions specified in this ActionMessageFilter.
public:
override bool Match(System::ServiceModel::Channels::MessageBuffer ^ messageBuffer);
public:
override bool Match(System::ServiceModel::Channels::MessageBuffer ^ buffer);
public override bool Match (System.ServiceModel.Channels.MessageBuffer messageBuffer);
public override bool Match (System.ServiceModel.Channels.MessageBuffer buffer);
override this.Match : System.ServiceModel.Channels.MessageBuffer -> bool
override this.Match : System.ServiceModel.Channels.MessageBuffer -> bool
Public Overrides Function Match (messageBuffer As MessageBuffer) As Boolean
Public Overrides Function Match (buffer As MessageBuffer) As Boolean
参数
- messageBufferbuffer
- MessageBuffer
要测试的 MessageBuffer。The MessageBuffer to test.
返回
如果 MessageBuffer 操作标头与指定的操作之一相匹配,则为 true;否则为 false。true if the MessageBuffer action header matches one of the specified actions; otherwise, false.
例外
messageBuffer 为 null。messageBuffer is null.
注解
如果必须利用单个筛选器中的操作来测试消息,并且 Match 可用,则请使用 MessageBuffer 方法的此重载。Use this overload of the Match method when a message must be tested against the actions in a single filter and the MessageBuffer is available.