In fact, there are only rare cases when this leads to side effects. But if you get them, they are pretty thin. Besides compound primary keys and dictionary keys, which always require the correct implementation of Equals / GetHashCode.
NH takes care of instantiating an object only once in memory, so comparing links by default should work ... if it werenโt for lazy loading .
If you do not override Equals, you are having trouble working with proxies. There are always two instances: proxy and real entity . Both of them represent the same entity. Only with a correctly implemented Equals method can it be considered the same.
Stefan steinegger
source share