public override int GetHashCode() { unchecked { var hashCode = (Id != null ? Id.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (_name != null ? _name.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (_unitPrice != null ? _unitPrice.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (_unitType != null ? _unitType.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (_discount != null ? _discount.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (_quantity != null ? _quantity.GetHashCode() : 0); return(hashCode); } }