public override bool Equals(object obj)
        {
            EntityWithTypedId <IdT> compareTo = obj as EntityWithTypedId <IdT>;

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

            if (compareTo == null || !GetType().Equals(compareTo.GetTypeUnproxied()))
            {
                return(false);
            }

            if (HasSameNonDefaultIdAs(compareTo))
            {
                return(true);
            }

            // Since the Ids aren't the same, both of them must be transient to
            // compare domain signatures; because if one is transient and the
            // other is a persisted entity, then they cannot be the same object.
            return(IsTransient() && compareTo.IsTransient() &&
                   HasSameObjectSignatureAs(compareTo));
        }
 /// <summary>
 /// Returns true if self and the provided entity have the same Id values
 /// and the Ids are not of the default Id value
 /// </summary>
 private bool HasSameNonDefaultIdAs(EntityWithTypedId <IdT> compareTo)
 {
     return(!IsTransient() &&
            !compareTo.IsTransient() &&
            Id.Equals(compareTo.Id));
 }