lfaldanam / sharp-architecture

Automatically exported from code.google.com/p/sharp-architecture
Other
0 stars 0 forks source link

Modify Equals/GetHashCode to reflect best ideas #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
http://devpinoy.org/blogs/joeycalisay/archive/2006/07/17/Overriding-Equals-
and-GetHashCode.aspx
http://devpinoy.org/blogs/joeycalisay/archive/2007/07/16/resharper-s-
gethashcode-and-the-number-29.aspx

Original issue reported on code.google.com by wmccaffe...@gmail.com on 2 Sep 2008 at 8:13

GoogleCodeExporter commented 9 years ago
Mike Walters provided the following, good suggestion:

public override int GetHashCode() {
       return _myObj1.GetHashCode() ^ _myObj2.GetHashCode() ^ _myObj3.GetHashCode();
}

Original comment by wmccaffe...@gmail.com on 3 Sep 2008 at 3:20

GoogleCodeExporter commented 9 years ago
Luis proposed the idea that transient objects (with ID of 0) should never be 
equal 
to a persistent object (with ID > 0):  http://groups.google.com/group/sharp-
architecture/browse_thread/thread/8c5ef0572c8ca1cd?hl=en

Original comment by wmccaffe...@gmail.com on 3 Sep 2008 at 5:18

GoogleCodeExporter commented 9 years ago
I've created a patch which addresses all these issues, with tests, I'd be glad 
to
receive some feedback about it.

Original comment by simone.b...@gmail.com on 3 Sep 2008 at 7:57

Attachments:

GoogleCodeExporter commented 9 years ago
That should do the trick...i think...

Original comment by lab...@gmail.com on 3 Sep 2008 at 8:29

GoogleCodeExporter commented 9 years ago
I've changed both the logic behind equality between persistent and transient 
objects
and the implementation of the domain signature computation.

Original comment by simone.b...@gmail.com on 3 Sep 2008 at 8:32

GoogleCodeExporter commented 9 years ago
Thank you for the input Simone, I've incorporated a slightly modified version 
of your 
script into the code...thanks again!

Original comment by wmccaffe...@gmail.com on 5 Oct 2008 at 2:54