From: Michael D. <mik...@us...> - 2005-02-06 01:59:46
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26787/Engine Modified Files: Cascades.cs ICollectionSnapshot.cs ISessionImplementor.cs Log Message: sergey's patch for the visitor pattern from h2.1. Index: ISessionImplementor.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/ISessionImplementor.cs,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ISessionImplementor.cs 31 Dec 2004 17:36:22 -0000 1.26 --- ISessionImplementor.cs 6 Feb 2005 01:58:57 -0000 1.27 *************** *** 38,57 **** /// <summary> - /// Register an uninitialized <c>PersistentColleciton</c> that will be lazily initialized - /// </summary> - /// <param name="collection"></param> - /// <param name="persister"></param> - /// <param name="id"></param> - void AddUninitializedCollection( PersistentCollection collection, CollectionPersister persister, object id ); - - /// <summary> - /// Register an initialized <c>PersistentCollection</c> - /// </summary> - /// <param name="collection"></param> - /// <param name="persister"></param> - /// <param name="id"></param> - void AddInitializedCollection( PersistentCollection collection, CollectionPersister persister, object id ); - - /// <summary> /// Set the "shallow dirty" status of the collection. Called when the collection detects /// that the client is modifying it --- 38,41 ---- *************** *** 64,68 **** /// <param name="coolection"></param> /// <param name="writing"></param> ! void Initialize( PersistentCollection coolection, bool writing ); /// <summary> --- 48,52 ---- /// <param name="coolection"></param> /// <param name="writing"></param> ! void InitializeCollection( PersistentCollection coolection, bool writing ); /// <summary> *************** *** 83,97 **** /// <summary> /// new in h2.0.3 and no javadoc - /// - /// MikeD added to help with EndRead of Collections... - /// </summary> - /// <param name="persister"></param> - /// <param name="id"></param> - /// <param name="owner"></param> - /// <returns></returns> - PersistentCollection GetLoadingCollection( CollectionPersister persister, object id, object owner ); - - /// <summary> - /// new in h2.0.3 and no javadoc /// </summary> /// <param name="role"></param> --- 67,70 ---- *************** *** 105,108 **** --- 78,82 ---- void EndLoadingCollections(); + object GetCollection( string role, object id, object owner ); /// <summary> *************** *** 161,165 **** /// <summary> ! /// After actually inserting a row, record the fact taht the instance exists on the database /// (needed for identity-column key generation) /// </summary> --- 135,139 ---- /// <summary> ! /// After actually inserting a row, record the fact that the instance exists on the database /// (needed for identity-column key generation) /// </summary> *************** *** 175,179 **** /// <summary> ! /// After actually updating a row, record the fact that the database state has been update. /// </summary> /// <param name="obj">The <see cref="object"/> instance that was saved.</param> --- 149,153 ---- /// <summary> ! /// After actually updating a row, record the fact that the database state has been updated. /// </summary> /// <param name="obj">The <see cref="object"/> instance that was saved.</param> Index: Cascades.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/Cascades.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Cascades.cs 23 Jan 2005 15:54:23 -0000 1.12 --- Cascades.cs 6 Feb 2005 01:58:56 -0000 1.13 *************** *** 35,39 **** /// session cache /// </summary> ! CascadeOnEvict = 0 //-1 } --- 35,44 ---- /// session cache /// </summary> ! CascadeOnEvict = 0, //-1 ! ! /// <summary> ! /// A cascade point that occurs just after locking the parent entity ! /// </summary> ! CascadeOnLock = 0 } *************** *** 58,62 **** /// Cascade the action to the child object /// </summary> ! public abstract void Cascade( ISessionImplementor session, object child ); /// <summary> --- 63,67 ---- /// Cascade the action to the child object /// </summary> ! public abstract void Cascade( ISessionImplementor session, object child, object anything ); /// <summary> *************** *** 73,77 **** private class ActionDeleteClass : CascadingAction { ! public override void Cascade( ISessionImplementor session, object child ) { log.Debug( "cascading to delete()" ); --- 78,82 ---- private class ActionDeleteClass : CascadingAction { ! public override void Cascade( ISessionImplementor session, object child, object anything ) { log.Debug( "cascading to delete()" ); *************** *** 99,103 **** private class ActionEvictClass : CascadingAction { ! public override void Cascade( ISessionImplementor session, object child ) { log.Debug( "cascading to evict()" ); --- 104,108 ---- private class ActionEvictClass : CascadingAction { ! public override void Cascade( ISessionImplementor session, object child, object anything ) { log.Debug( "cascading to evict()" ); *************** *** 118,126 **** /// <summary></summary> public static CascadingAction ActionSaveUpdate = new ActionSaveUpdateClass(); private class ActionSaveUpdateClass : CascadingAction { ! public override void Cascade( ISessionImplementor session, object child ) { log.Debug( "cascading to SaveOrUpdate()" ); --- 123,153 ---- /// <summary></summary> + public static CascadingAction ActionLock = new ActionLockClass(); + + private class ActionLockClass : CascadingAction + { + public override void Cascade( ISessionImplementor session, object child, object anything ) + { + log.Debug( "cascading to lock()" ); + session.Lock( child, (LockMode) anything ); + } + + public override bool ShouldCascadeCollection( object collection ) + { + return CollectionIsInitialized( collection ); + } + + public override bool DeleteOrphans() + { + return false; + } + } + + /// <summary></summary> public static CascadingAction ActionSaveUpdate = new ActionSaveUpdateClass(); private class ActionSaveUpdateClass : CascadingAction { ! public override void Cascade( ISessionImplementor session, object child, object anything ) { log.Debug( "cascading to SaveOrUpdate()" ); *************** *** 323,327 **** /// <param name="cascadeTo"></param> /// <param name="deleteOrphans"></param> ! private static void Cascade( ISessionImplementor session, object child, IType type, CascadingAction action, CascadePoint cascadeTo, bool deleteOrphans ) { if( child != null ) --- 350,355 ---- /// <param name="cascadeTo"></param> /// <param name="deleteOrphans"></param> ! /// <param name="anything"></param> ! private static void Cascade( ISessionImplementor session, object child, IType type, CascadingAction action, CascadePoint cascadeTo, bool deleteOrphans, object anything ) { if( child != null ) *************** *** 333,337 **** if( type.IsEntityType || type.IsObjectType ) { ! action.Cascade( session, child ); } else if( type.IsPersistentCollectionType ) --- 361,365 ---- if( type.IsEntityType || type.IsObjectType ) { ! action.Cascade( session, child, anything ); } else if( type.IsPersistentCollectionType ) *************** *** 388,392 **** foreach( object obj in iter ) { ! Cascade( session, obj, elemType, action, cascadeVia, false ); } } --- 416,420 ---- foreach( object obj in iter ) { ! Cascade( session, obj, elemType, action, cascadeVia, false, anything ); } } *************** *** 417,421 **** if( ctype.Cascade( i ).DoCascade( action ) ) { ! Cascade( session, children[ i ], types[ i ], action, cascadeTo, deleteOrphans ); } } --- 445,449 ---- if( ctype.Cascade( i ).DoCascade( action ) ) { ! Cascade( session, children[ i ], types[ i ], action, cascadeTo, deleteOrphans, anything ); } } *************** *** 432,436 **** /// <param name="action"></param> /// <param name="cascadeTo"></param> ! public static void Cascade( ISessionImplementor session, IClassPersister persister, object parent, CascadingAction action, CascadePoint cascadeTo ) { if( persister.HasCascades ) --- 460,465 ---- /// <param name="action"></param> /// <param name="cascadeTo"></param> ! /// <param name="anything"></param> ! public static void Cascade( ISessionImplementor session, IClassPersister persister, object parent, CascadingAction action, CascadePoint cascadeTo, object anything ) { if( persister.HasCascades ) *************** *** 446,450 **** if( cascadeStyles[ i ].DoCascade( action ) ) { ! Cascade( session, persister.GetPropertyValue( parent, i ), types[ i ], action, cascadeTo, cascadeStyles[ i ] == CascadeStyle.StyleAllGC ); } } --- 475,479 ---- if( cascadeStyles[ i ].DoCascade( action ) ) { ! Cascade( session, persister.GetPropertyValue( parent, i ), types[ i ], action, cascadeTo, cascadeStyles[ i ] == CascadeStyle.StyleAllGC, anything ); } } Index: ICollectionSnapshot.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/ICollectionSnapshot.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ICollectionSnapshot.cs 31 Dec 2004 17:36:22 -0000 1.5 --- ICollectionSnapshot.cs 6 Feb 2005 01:58:57 -0000 1.6 *************** *** 37,44 **** /// <summary> ! /// Gets a <see cref="bool"/> indicating if the underlying collection has been ! /// initialized yet. /// </summary> ! bool IsInitialized { get; } } } \ No newline at end of file --- 37,44 ---- /// <summary> ! /// Gets a <see cref="bool"/> indicating if the collection was at one time ! /// associated with an Entity and then later dereferenced during a Flush(). /// </summary> ! bool WasDereferenced { get; } } } \ No newline at end of file |