public virtual bool Equals(EntityBase other) { if (other == null) return false; if (ReferenceEquals(this, other)) return true; if (!IsTransient(this) && !IsTransient(other) && Equals(ID, other.ID)) { var otherType = other.GetUnproxiedType(); var thisType = GetUnproxiedType(); return thisType.IsAssignableFrom(otherType) || otherType.IsAssignableFrom(thisType); } return false; }
private static bool IsTransient(EntityBase obj) { return obj != null && Equals(obj.ID, default(Guid)); }