Exemple #1
0
        /// <summary>
        /// Constructor of the base message object
        /// </summary>
        /// <param name="RequestId">Request ID</param>
        /// <param name="Type">Type of the message, Command, Response, Events</param>
        public MessageBase(string RequestId, MessageHeader.TypeEnum Type)
        {
            Contracts.IsNotNullOrWhitespace(RequestId, $"Invalid received in the {nameof(MessageBase)} constructor. { RequestId }");

            string attribNameValue = LookupMessageName(GetType());

            Contracts.IsNotNullOrWhitespace(attribNameValue, $"Invalid command Name attribute is set for the command or response structure in the {nameof(MessageBase)} constructor. { Type }");
            this.Headers = new MessageHeader(attribNameValue, RequestId, Type);
        }
Exemple #2
0
 /// <summary>
 /// Constructor of the message object for response
 /// The Payload property must be set by the derived class and passing paramters for the headers to the base class
 /// </summary>
 /// <param name="Name"></param>
 /// <param name="RequestId"></param>
 /// <param name="Type"></param>
 public Message(string RequestId, MessageHeader.TypeEnum Type, T Payload) :
     base(RequestId, Type)
 {
     this.Payload = Payload.Ignore();
 }