/// <summary> /// If the existing proxy is insufficiently "narrow" (derived), instantiate a /// new proxy and overwrite the registration of the old one. This breaks == and /// occurs only for "class" proxies rather than "interface" proxies. /// </summary> /// <param name="proxy"></param> /// <param name="persister"></param> /// <param name="key"></param> /// <param name="obj"></param> /// <returns></returns> public object NarrowProxy( object proxy, IClassPersister persister, Key key, object obj ) { if( !persister.ConcreteProxyClass.IsAssignableFrom( proxy.GetType() ) ) { if( log.IsWarnEnabled ) { log.Warn( "Narrowing proxy to " + persister.ConcreteProxyClass + " - this operation breaks ==" ); } if( obj != null ) { proxiesByKey.Remove( key ); return obj; } else { proxy = persister.CreateProxy( key.Identifier, this ); proxiesByKey[ key ] = proxy; return proxy; } } else { return proxy; } }