MessageFilter MessageFilter MessageFilter MessageFilter Class

定义

用于查询消息的筛选器的不同的类的 abstract 基类。abstract base class for different classes of filters used to query messages.

public ref class MessageFilter abstract
[System.Runtime.Serialization.DataContract]
[System.Runtime.Serialization.KnownType(typeof(System.ServiceModel.Dispatcher.MatchNoneMessageFilter))]
[System.Runtime.Serialization.KnownType(typeof(System.ServiceModel.Dispatcher.ActionMessageFilter))]
[System.Runtime.Serialization.KnownType(typeof(System.ServiceModel.Dispatcher.MatchAllMessageFilter))]
[System.Runtime.Serialization.KnownType(typeof(System.ServiceModel.Dispatcher.XPathMessageFilter))]
public abstract class MessageFilter
type MessageFilter = class
Public MustInherit Class MessageFilter
继承
MessageFilterMessageFilterMessageFilterMessageFilter
派生
属性

注解

MessageFilter 是一个 abstract 类,开发人员实现此类来指定用于检查消息的条件。MessageFilter is an abstract class that developers implement in order to specify the criteria to use for inspecting messages. 通常情况下,终结点应用程序使用筛选器根据检查消息的某部分来确定如何处理消息。Typically, filters are used by an endpoint application to determine what to do with a message based on an examination of some part of the message. 例如,查询过程可以使用 XPath 1.0 查询来检查已知标头的优先级元素,以确定是否将消息移动到队列的靠前位置。A queuing process, for example, can use an XPath 1.0 query to check the priority element of a known header to determine whether to move a message to the front of the queue.

筛选器存储在实现 IMessageFilterTable<TFilterData> 的筛选器表中。Filters are stored in a filter table that implements IMessageFilterTable<TFilterData>. 表中的每个筛选器与指定的筛选器数据相关联,这些消息可用于指示当消息与筛选器相匹配时采取的操作。Each filter in the table is associated with specified filter data that can be used to indicate what actions to take if a message matches the filter. Match 方法用于确定消息是否满足筛选器的条件。The Match methods are used to determine if a message satisfies a filter.

一旦构造筛选器,筛选器使用的条件无法更改,因为筛选器表无法检测更改。The criteria used by a filter cannot be changed once the filter is constructed because the filter tables have no way to detect a change. 修改筛选器的条件的唯一方法是构造一个新的筛选器,然后删除现有筛选器。The only way to modify the criteria of a filter is to construct a new one and delete the existing filter.

以下类实现 abstractMessageFilter 类:The following classes implement the abstractMessageFilter class:

ChannelListenerBase<TChannel> 是一个 abstract 基类,可用于编写非队列侦听程序。ChannelListenerBase<TChannel> is an abstract base class that you can use for writing non-queuing listeners.

构造函数

MessageFilter() MessageFilter() MessageFilter() MessageFilter()

在派生类中调用时,初始化 MessageFilter 类的新实例。When called in a derived class, initializes a new instance of the MessageFilter class.

方法

CreateFilterTable<FilterData>() CreateFilterTable<FilterData>() CreateFilterTable<FilterData>() CreateFilterTable<FilterData>()

创建与指定类型的数据相关联的筛选器的筛选器表。Creates a filter table for a filter that has a specified type of data associated with it.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
Match(Message) Match(Message) Match(Message) Match(Message)

在派生类中被重写时,测试消息是否满足筛选器的条件。When overridden in a derived class, tests whether a message satisfies the filter criteria. 无法检查正文。The body cannot be examined.

Match(MessageBuffer) Match(MessageBuffer) Match(MessageBuffer) Match(MessageBuffer)

在派生类中被重写时,测试缓冲的消息是否满足筛选器的条件。When overridden in a derived class, tests whether a buffered message satisfies the criteria of a filter.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

适用于