IMessageFilterTable(Of TFilterData) Interface

An interface that defines the contract that a filter table must implement to inspect messages with query criteria derived from one or more filters.

Namespace:  System.ServiceModel.Dispatcher
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

'Declaration
Public Interface IMessageFilterTable(Of TFilterData) _
	Inherits IDictionary(Of MessageFilter, TFilterData), ICollection(Of KeyValuePair(Of MessageFilter, TFilterData)),  _
	IEnumerable(Of KeyValuePair(Of MessageFilter, TFilterData)), IEnumerable
'Usage
Dim instance As IMessageFilterTable(Of TFilterData)

Type Parameters

TFilterData

The type of data associated with each filter in the table.

The filter table is a core component of the filter engine. The primary use of the filter engine in Windows Communication Foundation (WCF) is to match application logic to messages by finding all the filters that match a message.

A filter table allows multiple filters to be matched against a single message more efficiently than they can be matched separately. A filter table associates filter data with filters. The table is a collection of key-value pairs, where the key is the MessageFilter, and the value is the associated filter data. Filter data can be any data of the type specified in the generic parameter and can be used to specify what actions to take if a message is matched by a filter in the table.

Filter table entries can be accessed using the IDictionary(Of TKey, TValue) functionality that IMessageFilterTable(Of TFilterData) inherits.

Note that a filter instance can only be added to a given IMessageFilterTable(Of TFilterData) once. To add multiple instances of this filter to the same filter table, use a filter constructor to create additional instances.

A filter matches a message when the message satisfies the query criteria of the filter. There are four overloaded matching methods. The data returned is either the filter data or the MessageFilter objects themselves. This data is returned whether multiple matches are allowed or only a single match. The following table shows this information for each overload.

Method Name

Matches

Data Returned

GetMatchingValue

Single

FilterData

GetMatchingFilter

Single

MessageFilter

GetMatchingValues

Multiple

FilterData

GetMatchingFilters

Multiple

MessageFilter objects

Each method contains two overloads. The difference between the two overloads is that one takes a Message parameter and is not permitted to examine the contents of the body; the other takes a MessageBuffer parameter and can examine any part of the message. If you call a method with the message parameter, and the filter table contains a filter that examines the content of the message body, an exception is thrown. If you are unsure about the filters in a table, call the overload that takes a message buffer.

Message headers are automatically buffered and can be inspected by a filter without being consumed. But if the body is to be inspected by a filter, then the entire message must be buffered because an unbuffered message body is consumed by a query and its contents destroyed.

The following classes implement IMessageFilterTable(Of TFilterData):

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft