コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CollaborationInfo"/> class.
        /// </summary>
        /// <param name="agreement">The reference of an agreement between two parties.</param>
        /// <param name="service">The service which acts on the message.</param>
        /// <param name="action">The action within a service that acts on the message.</param>
        /// <param name="conversationId">The conversation identifier of the message.</param>
        public CollaborationInfo(
            AgreementReference agreement,
            Service service,
            string action,
            string conversationId)
        {
            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }

            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }

            if (conversationId == null)
            {
                throw new ArgumentNullException(nameof(conversationId));
            }

            AgreementReference = (agreement != null).ThenMaybe(agreement);
            Service            = service;
            Action             = action;
            ConversationId     = conversationId;
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CollaborationInfo"/> class.
 /// </summary>
 /// <param name="agreement">The reference of an agreement between two parties.</param>
 public CollaborationInfo(AgreementReference agreement)
     : this(
         agreement : agreement,
         service : Service.TestService,
         action : Constants.Namespaces.TestAction,
         conversationId : DefaultConversationId)
 {
 }
コード例 #3
0
 /// <summary>
 /// Serves as the default hash function.
 /// </summary>
 /// <returns>A hash code for the current object.</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = AgreementReference.GetHashCode();
         hashCode = (hashCode * 397) ^ Service.GetHashCode();
         hashCode = (hashCode * 397) ^ Action.GetHashCode();
         hashCode = (hashCode * 397) ^ ConversationId.GetHashCode();
         return(hashCode);
     }
 }
コード例 #4
0
        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns>true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false.</returns>
        public bool Equals(CollaborationInfo other)
        {
            if (other is null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(AgreementReference.Equals(other.AgreementReference) &&
                   Service.Equals(other.Service) &&
                   String.Equals(Action, other.Action) &&
                   String.Equals(ConversationId, other.ConversationId));
        }