I'm relying on a proxy being equal to itself and have not had any problems.

But there is this issue... does it apply to you?
https://nhibernate.jira.com/browse/NH-3070

/Oskar



2013/6/14 <[email protected]>

> We are upgrading an application that was using 3.0.0 with the Castle byte
> code provider to 3.3.3, and are having some difficulty with the proxy
> implementation of Equals in the new built-in LinFu.DynamicProxy
> implementation.  For years we have been getting by without implementing
> equals/gethashcode, and rely on reference equality for all comparisons.
>  After upgrading, to 3.3.3 proxies seem to no longer respect reference
> equality.  See below, which is actual output from a debugging session where
> I was looking at interceptions for Equals() calls that were made while
> attempting to remove an entity from
> a NHibernate.Collection.Generic.PersistentGenericBag:
>
> proxy.GetType().GetMethod("Equals").DeclaringType.FullName
> "ActivityProxy"
>
> proxy.GetType().BaseType.FullName
> "Domain.Model.Activity"
>
>
>
> proxy.GetType().BaseType.GetMethod("Equals").DeclaringType.FullName
> "System.Object"
>
> System.Object.ReferenceEquals(proxy, args[0])
> true
>
> proxy.Equals(args[0])
> false
>
>
> args[0].Equals(proxy)
> false
>
>
> I don't understand how an instance of a proxy is not equal to itself when
> the underlying type has not overridden Equals or GetHashCode...  Does
> NHibernate now require that you implement your own equality operator??
>  Mostly I'd like to know if this is a bug or expected behavior.
>
> Thanks in advance,
> nick
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/nhusers.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to