From: Michael D. <mik...@us...> - 2004-09-22 21:56:19
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14895/NHibernate/Impl Modified Files: SessionImpl.cs Log Message: Fix and test fixture for NH-52 Index: SessionImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionImpl.cs,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** SessionImpl.cs 22 Sep 2004 04:46:44 -0000 1.42 --- SessionImpl.cs 22 Sep 2004 21:56:02 -0000 1.43 *************** *** 2894,2900 **** /// return the wrapper /// </summary> ! /// <param name="obj"></param> ! /// <param name="type"></param> ! /// <returns></returns> private object Wrap(object obj, IType type) { --- 2894,2902 ---- /// return the wrapper /// </summary> ! /// <param name="obj">The <see cref="Object"/> to wrap.</param> ! /// <param name="type">The <see cref="IType"/> of the Property the obj came in for.</param> ! /// <returns> ! /// An <see cref="Object"/> that NHibernate has now been made aware of. ! /// </returns> private object Wrap(object obj, IType type) { *************** *** 2910,2913 **** --- 2912,2917 ---- if ( type.IsPersistentCollectionType ) { + // a previously wrapped collection from another session has come back + // into NHibernate if ( obj is PersistentCollection ) { *************** *** 2936,2957 **** } } ! else if ( obj.GetType().IsArray ) { ! // TODO: we could really re-use the existing arrayholder ! // for this new array (if it exists) ! ArrayHolder ah = GetArrayHolder(obj); ! if (ah==null) { ! ah = new ArrayHolder(this, obj); ! AddNewCollection(ah); ! AddArrayHolder(ah); } - } - else - { - PersistentCollection pc = ((PersistentCollectionType) type).Wrap(this, obj); - if ( log.IsDebugEnabled ) log.Debug( "Wrapped collection in role: " + ((PersistentCollectionType) type).Role); - AddNewCollection(pc); - obj = pc; } } --- 2940,2971 ---- } } ! ! // used to be code here to see if the obj.GetType().IsArray but don't want it ! // here because in .net an array is an IList - not true in java so NHibernate can ! // have an array passed to a type that is a List. ! ! // this is a new collection that NHibernate is not aware of. ! else { ! // if the Type of the collection is an ArrayType then we need to add it ! // to an ArrayHolder - TODO: figure out if this is really necessary since ! // Java and .NET treat arrays differently. ! if( type is ArrayType ) { ! ArrayHolder ah = GetArrayHolder( obj ); ! if( ah==null ) ! { ! ah = new ArrayHolder( this, obj ); ! AddNewCollection( ah ); ! AddArrayHolder( ah ); ! } ! } ! else ! { ! PersistentCollection pc = ((PersistentCollectionType) type).Wrap(this, obj); ! if ( log.IsDebugEnabled ) log.Debug( "Wrapped collection in role: " + ((PersistentCollectionType) type).Role); ! AddNewCollection(pc); ! obj = pc; } } } |