NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Message.Formatter

Gets or sets the formatter used to read or write an object into the message body.

[Visual Basic]
Public Property Formatter As IMessageFormatter
[C#]
public IMessageFormatter Formatter {get; set;}
[C++]
public: __property IMessageFormatter* get_Formatter();
public: __property void set_Formatter(IMessageFormatter*);
[JScript]
public function get Formatter() : IMessageFormatter;
public function set Formatter(IMessageFormatter);

Property Value

The IMessageFormatter that produces a stream to be written to the message body. The default is SoapMessageFormatter.

Exceptions

Exception Type Condition
ArgumentException The Formatter is a null reference (in Visual Basic Nothing).

Remarks

When the Formatter property is initially a null reference (Nothing), the Message attempts to read the body of the message in order to identify a compatible formatter. The formatter classes are used in the order indicated below. Each formatter attempts to determine if the contents of the message are can be read by that formatter.

  1. SoapMessageFormatter
  2. ActiveXMessageFormatter
  3. DataSetMessageFormatter

Use the Formatter both when reading and when writing the message in order to translate the message Body to a stream that can be sent to the message queue. If you use SoapMessageFormatter, the body can be read while it is in the stream state, and a separate XML-compatible formatter can be used to read the message. Any other formatter requires the same formatter to be used both for reading and writing. Binary formatters provide faster data transfer but do not allow a corrupted message to be repaired in the stream state.

See Also

Message Class | Message Members | System.Messaging Namespace | CanRead | SoapMessageFormatter | ActiveXMessageFormatter | BinaryMessageFormatter | DataSetMessageFormatter | TBD