Пример #1
0
        public override bool Equals(object obj)
        {
            var valueObject = obj as T;

            if (valueObject is null)
            {
                return(false);
            }

            if (ValueObject.GetUnproxiedType(this) != ValueObject.GetUnproxiedType(obj))
            {
                return(false);
            }

            return(EqualsCore(valueObject));
        }
Пример #2
0
        public override bool Equals(object obj)
        {
            if (!(obj is Entity <TId> other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if (ValueObject.GetUnproxiedType(this) != ValueObject.GetUnproxiedType(other))
            {
                return(false);
            }

            if (Id.Equals(default(TId)) || other.Id.Equals(default(TId)))
            {
                return(false);
            }

            return(Id.Equals(other.Id));
        }
Пример #3
0
 public override int GetHashCode()
 {
     return((ValueObject.GetUnproxiedType(this).ToString() + Id).GetHashCode());
 }