Here’s what we know: It’s recommended by NHibernate to override Equals() and GetHashCode(). It’s recommended by Microsoft that you NOT override operator == in non-immutable types. It seems, therefore, that client code should not be using operator== to compare objects. For example, assuming Foo overloads GetHashCode() and Equals correctly, then:
var foo1 = session.Get<Foo>(23);
...
var foo2 = session.Get<Foo>(23);
Assert.IsTrue( foo1 == foo2 ); // May fail!
Assert.IsTrue( foo1.Equals(foo2)); // Guaranteed!
Is this a correct summation?
The Hibernate session guarantees that both get-calls in your sample code would actually return the same object instance.
So in the case of persistent hibernate objects belonging to the same session the == operator would work reliably.