本文整理汇总了C#中Message.Validate方法的典型用法代码示例。如果您正苦于以下问题:C# Message.Validate方法的具体用法?C# Message.Validate怎么用?C# Message.Validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message.Validate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Publish
/// <inheritdoc />
public void Publish(Message message)
{
if (message == null)
throw new ArgumentNullException("message");
message.Validate();
}
示例2: Create
public Message Create(CreateMessageCommand command)
{
var message = new Message(command.BodyMessage, command.Destination, command.Date, command.IdUser, false);
message.Validate();
_repository.Create(message);
if (Commit())
return message;
return null;
}
示例3: Publish
/// <inheritdoc />
public void Publish(Message message)
{
if (message == null)
throw new ArgumentNullException("message");
if (!socket.Connected)
throw new InvalidOperationException("Not connected to the test runner.");
message.Validate();
var messageData = messageFormatter.Serialise(message);
var framedMessage = new FramedMessage(messageData);
framedMessage.WriteTo(socket);
}
示例4: Publish
public void Publish(Message message)
{
message.Validate();
message = message.Normalize();
eventDispatcher.NotifyMessageReceived(new MessageReceivedEventArgs(message));
consumer.Consume(message);
}
示例5: Publish
/// <inheritdoc />
public void Publish(Message message)
{
if (message == null)
throw new ArgumentNullException("message");
message.Validate();
lock (queue)
{
queue.Enqueue(message);
if (asyncResult == null)
{
asyncResult = asyncPublishLoop.BeginInvoke(null, null);
}
}
}
示例6: Publish
/// <summary>
/// Sends a message to the client.
/// </summary>
/// <param name="message">The message to send.</param>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="message"/> is null.</exception>
/// <exception cref="ValidationException">Thrown if <paramref name="message"/> is not valid.</exception>
public void Publish(Message message)
{
if (message == null)
throw new ArgumentNullException("message");
message.Validate();
lock (receiveQueue)
{
receiveQueue.Enqueue(message);
Monitor.PulseAll(receiveQueue);
}
}
示例7: ArgumentNullException
void IMessageExchangeLink.Send(Message message)
{
if (message == null)
throw new ArgumentNullException("message");
message.Validate();
messageSink.Publish(message);
}