示例#1
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is DeviceCode other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) &&
                   ((Code == null && other.Code == null) || (Code?.Equals(other.Code) == true)) &&
                   ((DeviceId == null && other.DeviceId == null) || (DeviceId?.Equals(other.DeviceId) == true)) &&
                   ((ProductType == null && other.ProductType == null) || (ProductType?.Equals(other.ProductType) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   ((PairBy == null && other.PairBy == null) || (PairBy?.Equals(other.PairBy) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((StatusChangedAt == null && other.StatusChangedAt == null) || (StatusChangedAt?.Equals(other.StatusChangedAt) == true)) &&
                   ((PairedAt == null && other.PairedAt == null) || (PairedAt?.Equals(other.PairedAt) == true)));
        }
示例#2
0
        public override int GetHashCode()
        {
            int hashCode = -1978949756;

            if (Id != null)
            {
                hashCode += Id.GetHashCode();
            }

            if (Name != null)
            {
                hashCode += Name.GetHashCode();
            }

            if (Code != null)
            {
                hashCode += Code.GetHashCode();
            }

            if (DeviceId != null)
            {
                hashCode += DeviceId.GetHashCode();
            }

            if (ProductType != null)
            {
                hashCode += ProductType.GetHashCode();
            }

            if (LocationId != null)
            {
                hashCode += LocationId.GetHashCode();
            }

            if (Status != null)
            {
                hashCode += Status.GetHashCode();
            }

            if (PairBy != null)
            {
                hashCode += PairBy.GetHashCode();
            }

            if (CreatedAt != null)
            {
                hashCode += CreatedAt.GetHashCode();
            }

            if (StatusChangedAt != null)
            {
                hashCode += StatusChangedAt.GetHashCode();
            }

            if (PairedAt != null)
            {
                hashCode += PairedAt.GetHashCode();
            }

            return(hashCode);
        }