MessageFilter 類別

定義

用來查詢訊息之不同篩選條件類別的 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
繼承
MessageFilter
衍生
屬性

備註

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> 是可以用來撰寫非佇列接聽程式 (Listener) 的 abstract 基底類別。ChannelListenerBase<TChannel> is an abstract base class that you can use for writing non-queuing listeners.

建構函式

MessageFilter()

在衍生類別中呼叫時,初始化 MessageFilter 類別的新執行個體。When called in a derived class, initializes a new instance of the MessageFilter class.

方法

CreateFilterTable<FilterData>()

建立篩選條件的篩選資料表,這個篩選條件具有與其相關聯的指定資料型別。Creates a filter table for a filter that has a specified type of data associated with it.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
Match(Message)

在衍生類別中覆寫時,測試訊息是否符合篩選條件的準則。When overridden in a derived class, tests whether a message satisfies the filter criteria. 本文無法進行檢查。The body cannot be examined.

Match(MessageBuffer)

在衍生類別中覆寫時,測試緩衝訊息是否符合篩選條件的準則。When overridden in a derived class, tests whether a buffered message satisfies the criteria of a filter.

MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

適用於