From: Paul H. <pha...@us...> - 2005-03-30 16:29:45
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21350/nhibernate/src/NHibernate/Engine Modified Files: Cascades.cs Versioning.cs Log Message: Implemented Copy, enhanced versioning, support named query/sql-query Index: Versioning.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/Versioning.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Versioning.cs 31 Dec 2004 17:36:41 -0000 1.6 --- Versioning.cs 30 Mar 2005 16:28:28 -0000 1.7 *************** *** 50,57 **** /// <param name="versionProperty">The index of the version property in the <c>fields</c> parameter.</param> /// <param name="versionType">The <see cref="IVersionType"/> of the versioned property.</param> /// <returns><c>true</c> if the version property needs to be seeded with an initial value.</returns> ! public static bool SeedVersion( object[ ] fields, int versionProperty, IVersionType versionType ) { ! if( fields[ versionProperty ] == null ) { fields[ versionProperty ] = Seed( versionType ); --- 50,58 ---- /// <param name="versionProperty">The index of the version property in the <c>fields</c> parameter.</param> /// <param name="versionType">The <see cref="IVersionType"/> of the versioned property.</param> + /// <param name="force">Force the version to initialize</param> /// <returns><c>true</c> if the version property needs to be seeded with an initial value.</returns> ! public static bool SeedVersion( object[ ] fields, int versionProperty, IVersionType versionType, bool force ) { ! if( fields[ versionProperty ] == null || force ) { fields[ versionProperty ] = Seed( versionType ); Index: Cascades.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/Cascades.cs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Cascades.cs 14 Mar 2005 18:52:11 -0000 1.18 --- Cascades.cs 30 Mar 2005 16:28:26 -0000 1.19 *************** *** 187,197 **** public override void Cascade( ISessionImplementor session, object child, object anything ) { ! log.Debug( "cascading to Replicate()" ); ! // TODO: 2.1 implement copy ! //session.Copy( child, (ReplicationMode) anything ); } public override ICollection CascadableChildrenCollection( PersistentCollectionType collectionType, object collection ) { return Cascades.GetLoadedElementsCollection( collectionType, collection ); } --- 187,197 ---- public override void Cascade( ISessionImplementor session, object child, object anything ) { ! log.Debug( "cascading to Copy()" ); ! session.Copy( child, (IDictionary) anything ); } public override ICollection CascadableChildrenCollection( PersistentCollectionType collectionType, object collection ) { + // saves / updates don't cascade to uninitialized collections return Cascades.GetLoadedElementsCollection( collectionType, collection ); } *************** *** 212,217 **** { log.Debug( "cascading to Replicate()" ); ! // TODO: 2.1 implement replication ! //session.Replicate( child, (ReplicationMode) anything ); } --- 212,216 ---- { log.Debug( "cascading to Replicate()" ); ! session.Replicate( child, (ReplicationMode) anything ); } *************** *** 460,464 **** /// Does the given identifier belong to a new instance /// </summary> ! public virtual bool IsUnsaved( object version ) { if( log.IsDebugEnabled ) --- 459,463 ---- /// Does the given identifier belong to a new instance /// </summary> ! public virtual object IsUnsaved( object version ) { if( log.IsDebugEnabled ) *************** *** 473,481 **** /// is null, otherwise assume it is a detached instance. /// </summary> ! public static VersionValue VersionNull = new VersionNullClass(); ! private class VersionNullClass : VersionValue { ! public override bool IsUnsaved( object version ) { log.Debug( "version unsaved-value strategy NULL" ); --- 472,480 ---- /// is null, otherwise assume it is a detached instance. /// </summary> ! public static VersionValue VersionSaveNull = new VersionSaveNullClass(); ! private class VersionSaveNullClass : VersionValue { ! public override object IsUnsaved( object version ) { log.Debug( "version unsaved-value strategy NULL" ); *************** *** 484,488 **** } - /* /// <summary> /// Assume the transient instance is newly instantiated if the version --- 483,486 ---- *************** *** 491,503 **** public static VersionValue VersionUndefined = new VersionUndefinedClass(); ! private class SaveNoneClass : IdentifierValue { ! public override bool IsUnsaved( object id ) { log.Debug( "version unsaved-value strategy UNDEFINED" ); ! return false; } } - */ /// <summary> --- 489,508 ---- public static VersionValue VersionUndefined = new VersionUndefinedClass(); ! private class VersionUndefinedClass : VersionValue { ! public override object IsUnsaved( object version ) { log.Debug( "version unsaved-value strategy UNDEFINED" ); ! //return version == null ? true : null; ! if ( version == null ) ! { ! return true; ! } ! else ! { ! return null; ! } } } /// <summary> *************** *** 509,513 **** private class VersionNegativeClass : VersionValue { ! public override bool IsUnsaved( object version ) { log.Debug( "version unsaved-value strategy NEGATIVE" ); --- 514,518 ---- private class VersionNegativeClass : VersionValue { ! public override object IsUnsaved( object version ) { log.Debug( "version unsaved-value strategy NEGATIVE" ); |