예제 #1
0
        /// <summary>
        ///     Create a new instance of <see cref="Message" />.
        /// </summary>
        /// <param name="body">Actual message</param>
        /// <param name="properties">Properties to attach</param>
        /// <exception cref="ArgumentNullException">body</exception>
        /// <exception cref="ArgumentException">Tried to wrap a <see cref="Message" /> in a <see cref="Message" /></exception>
        public Message(object body, IDictionary <string, string> properties)
        {
            if (body == null)
            {
                throw new ArgumentNullException(nameof(body));
            }
            if (body is Message)
            {
                throw new ArgumentException("Cannot wrap a Message in a Message, (inner type: " +
                                            ((Message)body).Body + ").");
            }

            MessageId  = GuidFactory.Create();
            Body       = body ?? throw new ArgumentNullException(nameof(body));
            Properties = properties;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="Command"/> class.
 /// </summary>
 public Command()
 {
     CommandId = GuidFactory.Create();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Request{TResult}"/> class.
 /// </summary>
 public Request()
 {
     RequestId = GuidFactory.Create();
 }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ApplicationEvent"/> class.
 /// </summary>
 public ApplicationEvent()
 {
     EventId = GuidFactory.Create();
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="Query{TResult}" /> class.
 /// </summary>
 public Query()
 {
     QueryId = GuidFactory.Create();
 }