ActionMessageFilter 類別

定義

表示查詢,這個查詢會測試訊息的動作是否為指定之動作集合中的動作。

public ref class ActionMessageFilter : System::ServiceModel::Dispatcher::MessageFilter
[System.Runtime.Serialization.DataContract]
public class ActionMessageFilter : System.ServiceModel.Dispatcher.MessageFilter
[<System.Runtime.Serialization.DataContract>]
type ActionMessageFilter = class
    inherit MessageFilter
Public Class ActionMessageFilter
Inherits MessageFilter
繼承
ActionMessageFilter
屬性

範例

下列範例會建立兩個 ActionMessageFilter,使用 Actions 屬性來從其中一個篩選條件取得動作字串,依據動作篩選條件直接測試訊息,並顯示套用篩選條件的結果。

using System;
using System.Collections.ObjectModel;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Dispatcher;

namespace UE.Wfc.Samples
{
    public static class ActionMessageFilterMatching
    {
        public static void Main()
        {
            // Create several action filters.
            ActionMessageFilter myActFltr = new ActionMessageFilter("1st Action", "2nd Action");
            ActionMessageFilter yourActFltr = new ActionMessageFilter("Your Action");

            // Display the ActionMessageFilter actions.
            ReadOnlyCollection<string> results = myActFltr.Actions;

            foreach (string result in results)
            {
                System.Console.WriteLine(result);
            }

            // Create a message.
            Message message = Message.CreateMessage(MessageVersion.Soap12WSAddressing10, "myBody");

            // Test the message action against a single action filter.
            bool test1 = myActFltr.Match(message);
            bool test2 = yourActFltr.Match(message);
            System.Console.WriteLine("The result of test1 is {0}", test1);
            System.Console.WriteLine("The result of test2 is {0}", test2);
        }
    }
}
Imports System.Collections.ObjectModel
Imports System.ServiceModel
Imports System.ServiceModel.Channels
Imports System.ServiceModel.Dispatcher

Namespace UE.Wfc.Samples
    Class ActionMessageFilterMatching

        Shared Sub Main()

            ' Create several action filters.
            Dim myActFltr As ActionMessageFilter = New ActionMessageFilter("1st Action", "2nd Action")
            Dim yourACtFltr As ActionMessageFilter = New ActionMessageFilter("Your Action")

            ' Display the ActionMessageFilter actions.
            Dim results As ReadOnlyCollection(Of String) = myActFltr.Actions

            For Each result As String In results
                System.Console.WriteLine(result)
            Next

            ' Create a message.
            Dim message As Message = Channels.Message.CreateMessage(MessageVersion.Soap11WSAddressing10, "myBody")

            ' Test the message action against a single action filter.
            Dim test1 As Boolean = myActFltr.Match(message)
            Dim test2 As Boolean = yourACtFltr.Match(message)
            System.Console.WriteLine("The result of test1 is {0}", test1)
            System.Console.WriteLine("The result of test2 is {0}", test2)

        End Sub
    End Class
End Namespace

備註

建構沒有任何動作的 ActionMessageFilter 是無效的。

這個型別可序列化為 DataContractAttribute

建構函式

ActionMessageFilter(String[])

使用這個篩選條件所測試的動作集合,初始化這個類別的新執行個體。

屬性

Actions

取得這個 ActionMessageFilter 所測試之動作字串的唯讀複本。

方法

CreateFilterTable<FilterData>()

建立可以有效率測試訊息動作的新篩選資料表。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
Match(Message)

測試訊息的動作是否符合這個 ActionMessageFilter 所指定的其中一個動作。

Match(MessageBuffer)

測試緩衝訊息的動作標頭是否符合這個 ActionMessageFilter 所指定的其中一個動作。

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於