コード例 #1
0
        /// <summary>
        /// Returns true if CategoryInfoWithProductCountDto instances are equal
        /// </summary>
        /// <param name="other">Instance of CategoryInfoWithProductCountDto to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(CategoryInfoWithProductCountDto other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     CategoryId == other.CategoryId ||

                     CategoryId.Equals(other.CategoryId)
                     ) &&
                 (
                     ParentCategoryId == other.ParentCategoryId ||
                     ParentCategoryId != null &&
                     ParentCategoryId.Equals(other.ParentCategoryId)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     ProductCount == other.ProductCount ||

                     ProductCount.Equals(other.ProductCount)
                 ));
        }
コード例 #2
0
 protected void SetCustomSearchCriteria(ref SearchBuilder sb)
 {
     if (ParentCategoryId.GetValueOrDefault() == Int32.MinValue)
     {
         sb.Criteria.Remove("ParentCategoryId=@parentCategoryId");
         sb.Criteria.Add("ParentCategoryId IS NULL");
     }
 }
コード例 #3
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)

                hashCode = hashCode * 59 + CategoryId.GetHashCode();
                if (ParentCategoryId != null)
                {
                    hashCode = hashCode * 59 + ParentCategoryId.GetHashCode();
                }
                if (Name != null)
                {
                    hashCode = hashCode * 59 + Name.GetHashCode();
                }

                hashCode = hashCode * 59 + ProductCount.GetHashCode();
                return(hashCode);
            }
        }