namespace BS.Shared.DataContracts
{
    public partial class CustomerPersonRelationDC
    {
        public override bool Equals(object obj)
        {
            if (obj is CustomerPersonRelationDC)
            {
                var y = (CustomerPersonRelationDC)obj;
                if (this.Customer2PersonOid == null && y.Customer2PersonOid == null)
                {
                    return this.GetHashCode() == y.GetHashCode();
                }

                if (this.Customer2PersonOid != null && y.Customer2PersonOid != null)
                {
                    return this.Customer2PersonOid == y.Customer2PersonOid;
                }
            }

            return false;
        }

        public override int GetHashCode()
        {
            return this.Customer2PersonOid.HasValue ? this.GetType().Name.GetHashCode() ^ this.Customer2PersonOid.GetHashCode() : base.GetHashCode();
        }
    }
}