diff --git a/src/NHibernate/Proxy/AbstractProxyFactory.cs b/src/NHibernate/Proxy/AbstractProxyFactory.cs index 86f156b5b67..eef2bbca3ce 100644 --- a/src/NHibernate/Proxy/AbstractProxyFactory.cs +++ b/src/NHibernate/Proxy/AbstractProxyFactory.cs @@ -3,6 +3,7 @@ using System.Reflection; using NHibernate.Engine; using NHibernate.Type; +using NHibernate.Util; namespace NHibernate.Proxy { @@ -17,6 +18,7 @@ public abstract class AbstractProxyFactory: IProxyFactory protected virtual MethodInfo GetIdentifierMethod { get; private set; } protected virtual MethodInfo SetIdentifierMethod { get; private set; } protected virtual IAbstractComponentType ComponentIdType { get; private set; } + protected virtual bool OverridesEquals { get; set; } protected bool IsClassProxy { @@ -39,6 +41,7 @@ public virtual void PostInstantiate(string entityName, System.Type persistentCla GetIdentifierMethod = getIdentifierMethod; SetIdentifierMethod = setIdentifierMethod; ComponentIdType = componentIdType; + OverridesEquals = ReflectHelper.OverridesEquals(persistentClass); } diff --git a/src/NHibernate/Proxy/DefaultLazyInitializer.cs b/src/NHibernate/Proxy/DefaultLazyInitializer.cs index 004926c1289..60266476e76 100644 --- a/src/NHibernate/Proxy/DefaultLazyInitializer.cs +++ b/src/NHibernate/Proxy/DefaultLazyInitializer.cs @@ -13,10 +13,8 @@ public class DefaultLazyInitializer : BasicLazyInitializer, DynamicProxy.IInterc { public DefaultLazyInitializer(string entityName, System.Type persistentClass, object id, MethodInfo getIdentifierMethod, MethodInfo setIdentifierMethod, IAbstractComponentType componentIdType, - ISessionImplementor session) - : base(entityName, persistentClass, id, getIdentifierMethod, setIdentifierMethod, componentIdType, session) {} - - #region Implementation of IInterceptor + ISessionImplementor session, bool overridesEquals) + : base(entityName, persistentClass, id, getIdentifierMethod, setIdentifierMethod, componentIdType, session, overridesEquals) {} public object Intercept(InvocationInfo info) { @@ -40,7 +38,5 @@ public object Intercept(InvocationInfo info) return returnValue; } - - #endregion } } \ No newline at end of file diff --git a/src/NHibernate/Proxy/DefaultProxyFactory.cs b/src/NHibernate/Proxy/DefaultProxyFactory.cs index add34899a41..3189f0ac9ba 100644 --- a/src/NHibernate/Proxy/DefaultProxyFactory.cs +++ b/src/NHibernate/Proxy/DefaultProxyFactory.cs @@ -14,7 +14,7 @@ public override INHibernateProxy GetProxy(object id, ISessionImplementor session { try { - var initializer = new DefaultLazyInitializer(EntityName, PersistentClass, id, GetIdentifierMethod, SetIdentifierMethod, ComponentIdType, session); + var initializer = new DefaultLazyInitializer(EntityName, PersistentClass, id, GetIdentifierMethod, SetIdentifierMethod, ComponentIdType, session, OverridesEquals); object proxyInstance = IsClassProxy ? factory.CreateProxy(PersistentClass, initializer, Interfaces) diff --git a/src/NHibernate/Proxy/Poco/BasicLazyInitializer.cs b/src/NHibernate/Proxy/Poco/BasicLazyInitializer.cs index 3a6700893a6..8c7aed84af4 100644 --- a/src/NHibernate/Proxy/Poco/BasicLazyInitializer.cs +++ b/src/NHibernate/Proxy/Poco/BasicLazyInitializer.cs @@ -22,14 +22,14 @@ public abstract class BasicLazyInitializer : AbstractLazyInitializer protected internal BasicLazyInitializer(string entityName, System.Type persistentClass, object id, MethodInfo getIdentifierMethod, MethodInfo setIdentifierMethod, - IAbstractComponentType componentIdType, ISessionImplementor session) + IAbstractComponentType componentIdType, ISessionImplementor session, bool overridesEquals) : base(entityName, id, session) { this.persistentClass = persistentClass; this.getIdentifierMethod = getIdentifierMethod; this.setIdentifierMethod = setIdentifierMethod; this.componentIdType = componentIdType; - overridesEquals = ReflectHelper.OverridesEquals(persistentClass); + this.overridesEquals = overridesEquals; } ///