Defines the core behavior of classes used to search for specific correlating data in a message.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
Thetype exposes the following members.
|CreateMessageQueryCollection||Creates a collection of queries that returns a specific type of data associated with it.|
|Equals(Object)||Determines whether the specified Object is equal to the current Object. (Inherited from Object.)|
|Evaluate(TResult)(Message)||When overridden in a derived class, runs a query against the message and returns a result. The body cannot be queried.|
|Evaluate(TResult)(MessageBuffer)||When overridden in a derived class, runs a query against the message and returns a result.|
|GetHashCode||Serves as a hash function for a particular type. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
The class is similar to the MessageFilter class. However, instead of returning matches, the Evaluate() method returns the results of evaluating a query against a message. The result of the query is a value in the message. Use the value as a key to correlate the message to other messages. To add a new property for the data, use the Add(String, Func(String)) method of the CorrelationDataMessageProperty class.
For a concrete implementation of the , see the XPathMessageQuery class.
Using the XPathMessageQuery and MessageQueryCollection classes
You can optimize the query process by creating a set of query objects and inserting them into an instance of the MessageQueryCollection class.
A common usage is to populate the collection with queries that have the same XPath predicate, but that differ only in the final leaf value. For example, the following XPath queries are identical except for the final clause. The first queries for all elements that have the quantity attribute set to 1, and the second queries for elements with the product attribute set to 'Contoso'):
"/s12:Envelope/s12:Body/PurchaseOrder/Items/Item[@quantity = 1]" "/s12:Envelope/s12:Body/PurchaseOrder/Items/Item[@product = 'Contoso']"
The MessageQueryCollection class allows you to create tables of queries that differ only slightly, enabling more efficient processing.
Alternatively, you can use the MessageQueryTable(TItem) class to store and evaluate message queries.
The following example creates a message and XPath message queries. The queries are evaluated by the XPathMessageQuery objects contained in an XPathMessageQueryCollection object. The results of each query are tested using the ResultType property of the XPathResult class.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2