XmlMessageFormatter.Read(Message) Método

Definição

Lê o conteúdo de determinada mensagem e cria um objeto que contém a mensagem desserializada.Reads the contents from the given message and creates an object that contains the deserialized message.

public:
 virtual System::Object ^ Read(System::Messaging::Message ^ message);
public object Read (System.Messaging.Message message);
abstract member Read : System.Messaging.Message -> obj
override this.Read : System.Messaging.Message -> obj
Public Function Read (message As Message) As Object

Parâmetros

message
Message

O Message, em formato XML, a ser desserializado.The Message, in XML format, to deserialize.

Retornos

Object

A mensagem desserializada.The deserialized message.

Implementações

Exceções

Nenhuma das propriedades TargetTypeNames ou TargetTypes foi definida.Neither the TargetTypeNames nor TargetTypes property has been set.

- ou --or- A instância serializada no corpo da mensagem não é compatível com nenhum dos esquemas representados pelos tipos nas propriedades TargetTypeNames e TargetTypes.The instance serialized in the message body does not comply with any of the schemas represented by the types in the TargetTypeNames and TargetTypes properties.

O parâmetro message é null.The message parameter is null.

Comentários

As TargetTypeNames Propriedades e TargetTypes dizem ao formatador quais esquemas tentar corresponder ao desserializar uma mensagem.Both the TargetTypeNames and TargetTypes properties tell the formatter what schemas to attempt to match when deserializing a message. Uma dessas propriedades deve ser definida antes que a mensagem possa ser desserializada.One of these properties must be set before the message can be deserialized.

A instância serializada no corpo da mensagem deve estar em conformidade com um dos esquemas representados na matriz de tipos.The instance serialized in the message body must comply with one of the schemas represented in the type array. Quando você lê a mensagem usando o Receive método, o método cria um objeto do tipo que corresponde ao esquema identificado e lê o corpo da mensagem nele.When you read the message using the Receive method, the method creates an object of the type that corresponds to the schema identified and reads the message body into it.

Os tipos de destino não precisam ser especificados para gravar na fila.The target types do not have to be specified in order to write to the queue.

Aplica-se a

Confira também