/// <summary>
 /// Equality method between two objects of the same type.
 /// Because the Equals method is strongly typed by generic constraints,
 /// it is not necessary to test for the correct object type.
 /// For safety we just want to match on business key value - in this case the fields
 /// that cannot be different between the two objects if they are supposedly equal.
 /// </summary>
 /// <param name="obj">The other object of this type that we are testing equality with</param>
 /// <returns></returns>
 public virtual bool Equals(ApplicationInformation <TIdType> obj)
 {
     if (obj != null)
     {
         // Transient objects are not considered as equal
         if (IsTransient() && obj.IsTransient())
         {
             return(false);
         }
         else
         {
             // For safe equality we need to match on business key equality.
             // Base domain entities are functionally equal if their key and metadata and tags are equal.
             // Subclasses should extend to include their own enhanced equality checks, as required.
             if (TenantId != null)
             {
                 return(Id.Equals(obj.Id) &&
                        Culture.Equals(obj.Culture) &&
                        ApplicationKey.Equals(obj.ApplicationKey) &&
                        Name.Equals(obj.Name));
             }
             else
             {
                 return(Id.Equals(obj.Id) &&
                        Culture.Equals(obj.Culture) &&
                        ApplicationKey.Equals(obj.ApplicationKey) &&
                        Name.Equals(obj.Name) &&
                        TenantId.Equals(obj.TenantId));
             }
         }
     }
     return(false);
 }
示例#2
0
        public bool Equals(BackblazeB2AuthorizationSession other)
        {
            if (EqualsPreamble(other) == false)
            {
                return(false);
            }

            return
                (AbsoluteMinimumPartSize == other.AbsoluteMinimumPartSize &&
                 AccountID.Equals(other.AccountID, StringComparison.Ordinal) &&
                 APIURL.Equals(other.APIURL, StringComparison.Ordinal) &&
                 ApplicationKey.Equals(other.ApplicationKey, StringComparison.Ordinal) &&
                 AuthorizationToken.Equals(other.AuthorizationToken, StringComparison.Ordinal) &&
                 DownloadURL.Equals(other.DownloadURL, StringComparison.Ordinal) &&
                 RecommendedPartSize == other.RecommendedPartSize &&
                 SessionExpirationDate.Equals(other.SessionExpirationDate));
        }