From: Kevin W. <kev...@us...> - 2004-12-31 17:36:34
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19205 Modified Files: Cascades.cs IBatcher.cs ICollectionSnapshot.cs ISessionFactoryImplementor.cs ISessionImplementor.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: ISessionImplementor.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/ISessionImplementor.cs,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ISessionImplementor.cs 29 Nov 2004 18:43:20 -0000 1.25 --- ISessionImplementor.cs 31 Dec 2004 17:36:22 -0000 1.26 *************** *** 3,9 **** using NHibernate.Collection; using NHibernate.Persister; - using NHibernate.Type; ! namespace NHibernate.Engine { /// <summary> --- 3,8 ---- using NHibernate.Collection; using NHibernate.Persister; ! namespace NHibernate.Engine { /// <summary> *************** *** 11,17 **** /// such as implementors of <c>Type</c> or <c>ClassPersister</c> /// </summary> ! public interface ISessionImplementor : ISession { - /// <summary> /// Get the pre-flush identifier of the collection --- 10,15 ---- /// such as implementors of <c>Type</c> or <c>ClassPersister</c> /// </summary> ! public interface ISessionImplementor : ISession { /// <summary> /// Get the pre-flush identifier of the collection *************** *** 19,28 **** /// <param name="collection"></param> /// <returns></returns> ! object GetLoadedCollectionKey(PersistentCollection collection); /// <summary> /// Get the snapshot of the pre-flush collection state /// </summary> ! object GetSnapshot(PersistentCollection collection); /// <summary> --- 17,26 ---- /// <param name="collection"></param> /// <returns></returns> ! object GetLoadedCollectionKey( PersistentCollection collection ); /// <summary> /// Get the snapshot of the pre-flush collection state /// </summary> ! object GetSnapshot( PersistentCollection collection ); /// <summary> *************** *** 31,35 **** /// <param name="array"></param> /// <returns></returns> ! ArrayHolder GetArrayHolder(object array); /// <summary> --- 29,33 ---- /// <param name="array"></param> /// <returns></returns> ! ArrayHolder GetArrayHolder( object array ); /// <summary> *************** *** 37,41 **** /// </summary> /// <param name="holder"></param> ! void AddArrayHolder(ArrayHolder holder); /// <summary> --- 35,39 ---- /// </summary> /// <param name="holder"></param> ! void AddArrayHolder( ArrayHolder holder ); /// <summary> *************** *** 45,50 **** /// <param name="persister"></param> /// <param name="id"></param> ! void AddUninitializedCollection(PersistentCollection collection, CollectionPersister persister, object id); ! /// <summary> /// Register an initialized <c>PersistentCollection</c> --- 43,48 ---- /// <param name="persister"></param> /// <param name="id"></param> ! void AddUninitializedCollection( PersistentCollection collection, CollectionPersister persister, object id ); ! /// <summary> /// Register an initialized <c>PersistentCollection</c> *************** *** 53,57 **** /// <param name="persister"></param> /// <param name="id"></param> ! void AddInitializedCollection(PersistentCollection collection, CollectionPersister persister, object id); /// <summary> --- 51,55 ---- /// <param name="persister"></param> /// <param name="id"></param> ! void AddInitializedCollection( PersistentCollection collection, CollectionPersister persister, object id ); /// <summary> *************** *** 59,63 **** /// that the client is modifying it /// </summary> ! void Dirty(PersistentCollection collection); /// <summary> --- 57,61 ---- /// that the client is modifying it /// </summary> ! void Dirty( PersistentCollection collection ); /// <summary> *************** *** 66,70 **** /// <param name="coolection"></param> /// <param name="writing"></param> ! void Initialize(PersistentCollection coolection, bool writing); /// <summary> --- 64,68 ---- /// <param name="coolection"></param> /// <param name="writing"></param> ! void Initialize( PersistentCollection coolection, bool writing ); /// <summary> *************** *** 73,77 **** /// <param name="collection"></param> /// <returns></returns> ! bool IsInverseCollection(PersistentCollection collection); /// <summary> --- 71,75 ---- /// <param name="collection"></param> /// <returns></returns> ! bool IsInverseCollection( PersistentCollection collection ); /// <summary> *************** *** 81,86 **** /// <param name="id"></param> /// <returns></returns> ! PersistentCollection GetLoadingCollection(CollectionPersister persister, object id); ! /// <summary> /// new in h2.0.3 and no javadoc --- 79,84 ---- /// <param name="id"></param> /// <returns></returns> ! PersistentCollection GetLoadingCollection( CollectionPersister persister, object id ); ! /// <summary> /// new in h2.0.3 and no javadoc *************** *** 92,97 **** /// <param name="owner"></param> /// <returns></returns> ! PersistentCollection GetLoadingCollection(CollectionPersister persister, object id, object owner); ! /// <summary> /// new in h2.0.3 and no javadoc --- 90,95 ---- /// <param name="owner"></param> /// <returns></returns> ! PersistentCollection GetLoadingCollection( CollectionPersister persister, object id, object owner ); ! /// <summary> /// new in h2.0.3 and no javadoc *************** *** 100,110 **** /// <param name="id"></param> /// <returns></returns> ! PersistentCollection GetLoadingCollection(String role, object id); ! /// <summary> /// new in h2.0.3 and no javadoc /// </summary> void EndLoadingCollections(); ! /// <summary> --- 98,108 ---- /// <param name="id"></param> /// <returns></returns> ! PersistentCollection GetLoadingCollection( String role, object id ); ! /// <summary> /// new in h2.0.3 and no javadoc /// </summary> void EndLoadingCollections(); ! /// <summary> *************** *** 118,122 **** /// </returns> /// <exception cref="ObjectNotFoundException">No object could be found with that <c>id</c>.</exception> ! object InternalLoad(System.Type persistentClass, object id); /// <summary> --- 116,120 ---- /// </returns> /// <exception cref="ObjectNotFoundException">No object could be found with that <c>id</c>.</exception> ! object InternalLoad( System.Type persistentClass, object id ); /// <summary> *************** *** 127,131 **** /// <param name="id"></param> /// <returns></returns> ! object InternalLoadOneToOne(System.Type persistentClass, object id); /// <summary> --- 125,129 ---- /// <param name="id"></param> /// <returns></returns> ! object InternalLoadOneToOne( System.Type persistentClass, object id ); /// <summary> *************** *** 135,146 **** /// <param name="id"></param> /// <returns></returns> ! object ImmediateLoad(System.Type persistentClass, object id); - /// <summary> - /// Load an instance immediately. Do not return a proxy - /// </summary> - /// <param name="persistentClass"></param> - /// <param name="id"></param> - /// <returns></returns> /// <summary> /// System time before the start of the transaction --- 133,145 ---- /// <param name="id"></param> /// <returns></returns> ! object ImmediateLoad( System.Type persistentClass, object id ); ! ! // /// <summary> ! // /// Load an instance immediately. Do not return a proxy ! // /// </summary> ! // /// <param name="persistentClass"></param> ! // /// <param name="id"></param> ! // /// <returns></returns> /// <summary> /// System time before the start of the transaction *************** *** 155,159 **** ISessionFactoryImplementor Factory { get; } ! /// <summary> /// Get the prepared statement <c>Batcher</c> for this session --- 154,158 ---- ISessionFactoryImplementor Factory { get; } ! /// <summary> /// Get the prepared statement <c>Batcher</c> for this session *************** *** 166,170 **** /// </summary> /// <param name="obj"></param> ! void PostInsert(object obj); /// <summary> --- 165,169 ---- /// </summary> /// <param name="obj"></param> ! void PostInsert( object obj ); /// <summary> *************** *** 173,178 **** /// </summary> /// <param name="obj"></param> ! void PostDelete(object obj); ! /// <summary> /// After actually updating a row, record the fact that the database state has been update. --- 172,177 ---- /// </summary> /// <param name="obj"></param> ! void PostDelete( object obj ); ! /// <summary> /// After actually updating a row, record the fact that the database state has been update. *************** *** 181,185 **** /// <param name="updatedState">A updated snapshot of the values in the object.</param> /// <param name="nextVersion">The new version to assign to the <c>obj</c>.</param> ! void PostUpdate(object obj, object[] updatedState, object nextVersion); /// <summary> --- 180,184 ---- /// <param name="updatedState">A updated snapshot of the values in the object.</param> /// <param name="nextVersion">The new version to assign to the <c>obj</c>.</param> ! void PostUpdate( object obj, object[ ] updatedState, object nextVersion ); /// <summary> *************** *** 189,193 **** /// <param name="parameters"></param> /// <returns></returns> ! IList Find(string query, QueryParameters parameters); /// <summary> --- 188,192 ---- /// <param name="parameters"></param> /// <returns></returns> ! IList Find( string query, QueryParameters parameters ); /// <summary> *************** *** 197,201 **** /// <param name="parameters"></param> /// <returns></returns> ! IEnumerable Enumerable(string query, QueryParameters parameters); /// <summary> --- 196,200 ---- /// <param name="parameters"></param> /// <returns></returns> ! IEnumerable Enumerable( string query, QueryParameters parameters ); /// <summary> *************** *** 206,210 **** /// <param name="parameters"></param> /// <returns></returns> ! IList Filter(object collection, string filter, QueryParameters parameters); /// <summary> --- 205,209 ---- /// <param name="parameters"></param> /// <returns></returns> ! IList Filter( object collection, string filter, QueryParameters parameters ); /// <summary> *************** *** 215,219 **** /// <param name="parameters"></param> /// <returns></returns> ! IEnumerable EnumerableFilter(object collection, string filter, QueryParameters parameters); /// <summary> --- 214,218 ---- /// <param name="parameters"></param> /// <returns></returns> ! IEnumerable EnumerableFilter( object collection, string filter, QueryParameters parameters ); /// <summary> *************** *** 222,226 **** /// <param name="obj"></param> /// <returns></returns> ! IClassPersister GetPersister(object obj); /// <summary> --- 221,225 ---- /// <param name="obj"></param> /// <returns></returns> ! IClassPersister GetPersister( object obj ); /// <summary> *************** *** 231,235 **** /// <param name="obj"></param> /// <param name="lockMode"></param> ! void AddUninitializedEntity(Key key, object obj, LockMode lockMode); /// <summary> --- 230,234 ---- /// <param name="obj"></param> /// <param name="lockMode"></param> ! void AddUninitializedEntity( Key key, object obj, LockMode lockMode ); /// <summary> *************** *** 241,251 **** /// <param name="obj"></param> /// <param name="lockMode"></param> ! void PostHydrate(IClassPersister persister, object id, object[] values, object obj, LockMode lockMode); ! /// <summary> /// Perform the second step of 2-phase load (ie. fully initialize the entity instance) /// </summary> /// <param name="obj"></param> ! void InitializeEntity(object obj); /// <summary> --- 240,250 ---- /// <param name="obj"></param> /// <param name="lockMode"></param> ! void PostHydrate( IClassPersister persister, object id, object[ ] values, object obj, LockMode lockMode ); ! /// <summary> /// Perform the second step of 2-phase load (ie. fully initialize the entity instance) /// </summary> /// <param name="obj"></param> ! void InitializeEntity( object obj ); /// <summary> *************** *** 254,258 **** /// <param name="key"></param> /// <returns></returns> ! object GetEntity(Key key); /// <summary> --- 253,257 ---- /// <param name="key"></param> /// <returns></returns> ! object GetEntity( Key key ); /// <summary> *************** *** 264,268 **** /// <param name="impl"></param> /// <returns>Returns a the Proxy for the class or the parameter impl.</returns> ! object ProxyFor(IClassPersister persister, Key key, object impl); /// <summary> --- 263,267 ---- /// <param name="impl"></param> /// <returns>Returns a the Proxy for the class or the parameter impl.</returns> ! object ProxyFor( IClassPersister persister, Key key, object impl ); /// <summary> *************** *** 271,275 **** /// <param name="impl"></param> /// <returns></returns> ! object ProxyFor(object impl); /// <summary> --- 270,274 ---- /// <param name="impl"></param> /// <returns></returns> ! object ProxyFor( object impl ); /// <summary> *************** *** 284,288 **** /// <param name="obj"></param> /// <returns></returns> ! object GetEntityIdentifier(object obj); /// <summary> --- 283,287 ---- /// <param name="obj"></param> /// <returns></returns> ! object GetEntityIdentifier( object obj ); /// <summary> *************** *** 292,299 **** /// <param name="obj"></param> /// <returns></returns> ! object GetEntityIdentifierIfNotUnsaved(object obj); ! ! bool IsSaved(object obj); /// <summary> --- 291,302 ---- /// <param name="obj"></param> /// <returns></returns> ! object GetEntityIdentifierIfNotUnsaved( object obj ); ! /// <summary> ! /// ! /// </summary> ! /// <param name="obj"></param> ! /// <returns></returns> ! bool IsSaved( object obj ); /// <summary> *************** *** 303,307 **** /// <param name="id"></param> /// <returns></returns> ! object Instantiate(System.Type clazz, object id); /// <summary> --- 306,310 ---- /// <param name="id"></param> /// <returns></returns> ! object Instantiate( System.Type clazz, object id ); /// <summary> *************** *** 310,314 **** /// <param name="entity"></param> /// <param name="lockMode"></param> ! void SetLockMode(object entity, LockMode lockMode); /// <summary> --- 313,317 ---- /// <param name="entity"></param> /// <param name="lockMode"></param> ! void SetLockMode( object entity, LockMode lockMode ); /// <summary> *************** *** 316,320 **** /// </summary> /// <param name="entity"></param> ! object GetVersion(object entity); /// <summary> --- 319,323 ---- /// </summary> /// <param name="entity"></param> ! object GetVersion( object entity ); /// <summary> *************** *** 323,327 **** /// <param name="entity"></param> /// <returns></returns> ! LockMode GetLockMode(object entity); /// <summary> --- 326,330 ---- /// <param name="entity"></param> /// <returns></returns> ! LockMode GetLockMode( object entity ); /// <summary> *************** *** 331,336 **** /// <param name="coll"></param> /// <returns></returns> ! ICollection GetOrphans(PersistentCollection coll); } ! } --- 334,339 ---- /// <param name="coll"></param> /// <returns></returns> ! ICollection GetOrphans( PersistentCollection coll ); } ! } \ No newline at end of file Index: ISessionFactoryImplementor.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/ISessionFactoryImplementor.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ISessionFactoryImplementor.cs 21 Dec 2004 20:43:41 -0000 1.12 --- ISessionFactoryImplementor.cs 31 Dec 2004 17:36:22 -0000 1.13 *************** *** 1,12 **** - using System; using System.Collections; using System.Data; using NHibernate.Connection; using NHibernate.Persister; - using NHibernate.Collection; - using NHibernate.Dialect; using NHibernate.Type; ! namespace NHibernate.Engine { /// <summary> --- 1,10 ---- using System.Collections; using System.Data; + using NHibernate.Collection; using NHibernate.Connection; using NHibernate.Persister; using NHibernate.Type; ! namespace NHibernate.Engine { /// <summary> *************** *** 14,24 **** /// such as implementors of <c>IType</c>. /// </summary> ! public interface ISessionFactoryImplementor : IMapping, ISessionFactory { /// <summary> /// TODO: determine if this is more appropriate for ISessionFactory /// </summary> ! IConnectionProvider ConnectionProvider {get;} ! /// <summary> /// Gets the IsolationLevel an IDbTransaction should be set to. --- 12,22 ---- /// such as implementors of <c>IType</c>. /// </summary> ! public interface ISessionFactoryImplementor : IMapping, ISessionFactory { /// <summary> /// TODO: determine if this is more appropriate for ISessionFactory /// </summary> ! IConnectionProvider ConnectionProvider { get; } ! /// <summary> /// Gets the IsolationLevel an IDbTransaction should be set to. *************** *** 32,36 **** /// Get the persister for a class /// </summary> ! IClassPersister GetPersister(System.Type clazz); /// <summary> --- 30,34 ---- /// Get the persister for a class /// </summary> ! IClassPersister GetPersister( System.Type clazz ); /// <summary> *************** *** 40,44 **** /// <returns>The <see cref="IClassPersister"/> for the class.</returns> /// <exception cref="MappingException">If no <see cref="IClassPersister"/> can be found.</exception> ! IClassPersister GetPersister(string className); /// <summary> --- 38,42 ---- /// <returns>The <see cref="IClassPersister"/> for the class.</returns> /// <exception cref="MappingException">If no <see cref="IClassPersister"/> can be found.</exception> ! IClassPersister GetPersister( string className ); /// <summary> *************** *** 49,53 **** /// <returns>The <see cref="IClassPersister"/> for the class.</returns> /// <exception cref="MappingException">If no <see cref="IClassPersister"/> can be found and throwException is <c>true</c>.</exception> ! IClassPersister GetPersister(string className, bool throwException); /// <summary> --- 47,51 ---- /// <returns>The <see cref="IClassPersister"/> for the class.</returns> /// <exception cref="MappingException">If no <see cref="IClassPersister"/> can be found and throwException is <c>true</c>.</exception> ! IClassPersister GetPersister( string className, bool throwException ); /// <summary> *************** *** 56,60 **** /// <param name="role"></param> /// <returns></returns> ! CollectionPersister GetCollectionPersister(string role); /// <summary> --- 54,58 ---- /// <param name="role"></param> /// <returns></returns> ! CollectionPersister GetCollectionPersister( string role ); /// <summary> *************** *** 84,88 **** /// <param name="queryString"></param> /// <returns></returns> ! IType[] GetReturnTypes(string queryString); /// <summary> --- 82,86 ---- /// <param name="queryString"></param> /// <returns></returns> ! IType[ ] GetReturnTypes( string queryString ); /// <summary> *************** *** 91,95 **** /// <param name="queryString"></param> /// <returns></returns> ! ICollection GetNamedParameters(string queryString); /// <summary> --- 89,93 ---- /// <param name="queryString"></param> /// <returns></returns> ! ICollection GetNamedParameters( string queryString ); /// <summary> *************** *** 103,107 **** /// </summary> /// <param name="conn"></param> ! void CloseConnection(IDbConnection conn); /// <summary> --- 101,105 ---- /// </summary> /// <param name="conn"></param> ! void CloseConnection( IDbConnection conn ); /// <summary> *************** *** 110,114 **** /// <param name="clazz"></param> /// <returns></returns> ! string[] GetImplementors(System.Type clazz); /// <summary> --- 108,112 ---- /// <param name="clazz"></param> /// <returns></returns> ! string[ ] GetImplementors( System.Type clazz ); /// <summary> *************** *** 117,121 **** /// <param name="name"></param> /// <returns></returns> ! string GetImportedClassName(string name); } ! } --- 115,119 ---- /// <param name="name"></param> /// <returns></returns> ! string GetImportedClassName( string name ); } ! } \ No newline at end of file Index: Cascades.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/Cascades.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Cascades.cs 13 Apr 2004 14:59:10 -0000 1.10 --- Cascades.cs 31 Dec 2004 17:36:22 -0000 1.11 *************** *** 1,16 **** - using System; using System.Collections; ! using NHibernate.Type; ! using NHibernate.Proxy; ! using NHibernate.Persister; using NHibernate.Collection; ! ! namespace NHibernate.Engine { ! /// <summary> /// The types of children to cascade to /// </summary> ! public enum CascadePoint { /// <summary> /// A cascade point that occurs just after the insertion of the parent --- 1,15 ---- using System.Collections; ! using log4net; using NHibernate.Collection; + using NHibernate.Persister; + using NHibernate.Type; ! namespace NHibernate.Engine ! { /// <summary> /// The types of children to cascade to /// </summary> ! public enum CascadePoint ! { /// <summary> /// A cascade point that occurs just after the insertion of the parent *************** *** 42,77 **** /// Summary description for Cascades. /// </summary> ! public class Cascades { ! private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Cascades)); ! /// <summary> /// A session action that may be cascaded from parent entity to its children /// </summary> ! public abstract class CascadingAction { ! protected CascadingAction() {} /// <summary> /// Cascade the action to the child object /// </summary> ! public abstract void Cascade(ISessionImplementor session, object child); /// <summary> /// Should this action be cascaded to the given (possibly unitilized) collection? /// </summary> ! public abstract bool ShouldCascadeCollection(object collection); public abstract bool DeleteOrphans(); public static CascadingAction ActionDelete = new ActionDeleteClass(); ! ! private class ActionDeleteClass : CascadingAction { ! public override void Cascade(ISessionImplementor session, object child) { ! log.Debug("cascading to delete()"); ! if(session.IsSaved(child)) session.Delete(child); } ! public override bool ShouldCascadeCollection(object collection) { return true; --- 41,86 ---- /// Summary description for Cascades. /// </summary> ! public class Cascades ! { ! private static readonly ILog log = LogManager.GetLogger( typeof( Cascades ) ); ! /// <summary> /// A session action that may be cascaded from parent entity to its children /// </summary> ! public abstract class CascadingAction ! { ! /// <summary></summary> ! protected CascadingAction() ! { ! } /// <summary> /// Cascade the action to the child object /// </summary> ! public abstract void Cascade( ISessionImplementor session, object child ); /// <summary> /// Should this action be cascaded to the given (possibly unitilized) collection? /// </summary> ! public abstract bool ShouldCascadeCollection( object collection ); + /// <summary></summary> public abstract bool DeleteOrphans(); + /// <summary></summary> public static CascadingAction ActionDelete = new ActionDeleteClass(); ! ! private class ActionDeleteClass : CascadingAction { ! public override void Cascade( ISessionImplementor session, object child ) { ! log.Debug( "cascading to delete()" ); ! if( session.IsSaved( child ) ) ! { ! session.Delete( child ); ! } } ! public override bool ShouldCascadeCollection( object collection ) { return true; *************** *** 85,101 **** } public static CascadingAction ActionEvict = new ActionEvictClass(); ! ! private class ActionEvictClass : CascadingAction { ! public override void Cascade(ISessionImplementor session, object child) { ! log.Debug("cascading to evict()"); ! session.Evict(child); } ! public override bool ShouldCascadeCollection(object collection) { ! return CollectionIsInitialized(collection); } --- 94,111 ---- } + /// <summary></summary> public static CascadingAction ActionEvict = new ActionEvictClass(); ! ! private class ActionEvictClass : CascadingAction { ! public override void Cascade( ISessionImplementor session, object child ) { ! log.Debug( "cascading to evict()" ); ! session.Evict( child ); } ! public override bool ShouldCascadeCollection( object collection ) { ! return CollectionIsInitialized( collection ); } *************** *** 107,122 **** } public static CascadingAction ActionSaveUpdate = new ActionSaveUpdateClass(); ! ! private class ActionSaveUpdateClass : CascadingAction { ! public override void Cascade(ISessionImplementor session, object child) { ! log.Debug("cascading to SaveOrUpdate()"); ! session.SaveOrUpdate(child); } ! public override bool ShouldCascadeCollection(object collection) { ! return CollectionIsInitialized(collection); // saves/updates don't cascade to uninitialized collections } --- 117,134 ---- } + /// <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()" ); ! session.SaveOrUpdate( child ); } ! public override bool ShouldCascadeCollection( object collection ) ! { ! return CollectionIsInitialized( collection ); // saves/updates don't cascade to uninitialized collections } *************** *** 129,141 **** } ! private static bool CollectionIsInitialized( object collection ) { ! return !(collection is PersistentCollection) || ( (PersistentCollection) collection).WasInitialized; } } ! public abstract class CascadeStyle { ! protected CascadeStyle() { } /// <summary> --- 141,157 ---- } ! private static bool CollectionIsInitialized( object collection ) { ! return !( collection is PersistentCollection ) || ( ( PersistentCollection ) collection ).WasInitialized; } } ! /// <summary></summary> ! public abstract class CascadeStyle { ! /// <summary></summary> ! protected CascadeStyle() ! { ! } /// <summary> *************** *** 144,160 **** /// <param name="action"></param> /// <returns></returns> ! public abstract bool DoCascade(CascadingAction action); //TODO: H2.0.3 - it looks like the CascadeStyle subclasses are defined outside of the CascadeStyle // class ! /// <summary> /// Save/Delete/Update/Evict + delete orphans /// </summary> public static CascadeStyle StyleAllGC = new StyleAllGCClass(); ! private class StyleAllGCClass : CascadeStyle { ! public override bool DoCascade(CascadingAction action) { return true; --- 160,176 ---- /// <param name="action"></param> /// <returns></returns> ! public abstract bool DoCascade( CascadingAction action ); //TODO: H2.0.3 - it looks like the CascadeStyle subclasses are defined outside of the CascadeStyle // class ! /// <summary> /// Save/Delete/Update/Evict + delete orphans /// </summary> public static CascadeStyle StyleAllGC = new StyleAllGCClass(); ! private class StyleAllGCClass : CascadeStyle { ! public override bool DoCascade( CascadingAction action ) { return true; *************** *** 167,174 **** public static CascadeStyle StyleAll = new StyleAllClass(); ! ! private class StyleAllClass : CascadeStyle { ! public override bool DoCascade(CascadingAction action) { return true; --- 183,190 ---- public static CascadeStyle StyleAll = new StyleAllClass(); ! ! private class StyleAllClass : CascadeStyle { ! public override bool DoCascade( CascadingAction action ) { return true; *************** *** 181,187 **** public static CascadeStyle StyleSaveUpdate = new StyleSaveUpdateClass(); ! private class StyleSaveUpdateClass : CascadeStyle { ! public override bool DoCascade(CascadingAction action) { return action == CascadingAction.ActionSaveUpdate; --- 197,203 ---- public static CascadeStyle StyleSaveUpdate = new StyleSaveUpdateClass(); ! private class StyleSaveUpdateClass : CascadeStyle { ! public override bool DoCascade( CascadingAction action ) { return action == CascadingAction.ActionSaveUpdate; *************** *** 193,200 **** /// </summary> public static CascadeStyle StyleOnlyDelete = new StyleOnlyDeleteClass(); ! ! private class StyleOnlyDeleteClass : CascadeStyle { ! public override bool DoCascade(CascadingAction action) { return action == CascadingAction.ActionDelete; --- 209,216 ---- /// </summary> public static CascadeStyle StyleOnlyDelete = new StyleOnlyDeleteClass(); ! ! private class StyleOnlyDeleteClass : CascadeStyle { ! public override bool DoCascade( CascadingAction action ) { return action == CascadingAction.ActionDelete; *************** *** 208,214 **** public static CascadeStyle StyleNone = new StyleNoneClass(); ! private class StyleNoneClass : CascadeStyle { ! public override bool DoCascade(CascadingAction action) { return false; --- 224,230 ---- public static CascadeStyle StyleNone = new StyleNoneClass(); ! private class StyleNoneClass : CascadeStyle { ! public override bool DoCascade( CascadingAction action ) { return false; *************** *** 222,230 **** /// is determined by the <c>Unsaved-Value</c> attribute in the mapping file. /// </summary> ! public class IdentifierValue { private object value; ! protected IdentifierValue() { this.value = null; --- 238,247 ---- /// is determined by the <c>Unsaved-Value</c> attribute in the mapping file. /// </summary> ! public class IdentifierValue { private object value; ! /// <summary></summary> ! protected IdentifierValue() { this.value = null; *************** *** 236,240 **** /// </summary> /// <param name="value"></param> ! public IdentifierValue(object value) { this.value = value; --- 253,257 ---- /// </summary> /// <param name="value"></param> ! public IdentifierValue( object value ) { this.value = value; *************** *** 244,251 **** /// Does the given identifier belong to a new instance /// </summary> ! public virtual bool IsUnsaved(object id) { ! if ( log.IsDebugEnabled ) log.Debug("unsaved-value: " + value); ! return id==null || value.Equals(id); } --- 261,271 ---- /// Does the given identifier belong to a new instance /// </summary> ! public virtual bool IsUnsaved( object id ) { ! if( log.IsDebugEnabled ) ! { ! log.Debug( "unsaved-value: " + value ); ! } ! return id == null || value.Equals( id ); } *************** *** 255,263 **** public static IdentifierValue SaveAny = new SaveAnyClass(); ! private class SaveAnyClass : IdentifierValue { ! public override bool IsUnsaved(object id) { ! log.Debug("unsaved-value strategy ANY"); return true; } --- 275,283 ---- public static IdentifierValue SaveAny = new SaveAnyClass(); ! private class SaveAnyClass : IdentifierValue { ! public override bool IsUnsaved( object id ) { ! log.Debug( "unsaved-value strategy ANY" ); return true; } *************** *** 269,277 **** public static IdentifierValue SaveNone = new SaveNoneClass(); ! private class SaveNoneClass : IdentifierValue { ! public override bool IsUnsaved(object id) { ! log.Debug("unsaved-value strategy NONE"); return false; } --- 289,297 ---- public static IdentifierValue SaveNone = new SaveNoneClass(); ! private class SaveNoneClass : IdentifierValue { ! public override bool IsUnsaved( object id ) { ! log.Debug( "unsaved-value strategy NONE" ); return false; } *************** *** 283,302 **** /// </summary> public static IdentifierValue SaveNull = new SaveNullClass(); ! ! private class SaveNullClass : IdentifierValue { ! public override bool IsUnsaved(object id) { ! log.Debug("unsaved-value strategy NULL"); ! return id==null; } } } ! [Obsolete("This is being replaced by the Cascade with a deleteOrphans as the last param.")] ! private static void Cascade(ISessionImplementor session, object child, IType type, CascadingAction action, CascadePoint cascadeTo) ! { ! Cascade(session, child, type, action, cascadeTo, false); ! } /// <summary> --- 303,322 ---- /// </summary> public static IdentifierValue SaveNull = new SaveNullClass(); ! ! private class SaveNullClass : IdentifierValue { ! public override bool IsUnsaved( object id ) { ! log.Debug( "unsaved-value strategy NULL" ); ! return id == null; } } } ! // [System.Obsolete( "This is being replaced by the Cascade with a deleteOrphans as the last param." )] ! // private static void Cascade( ISessionImplementor session, object child, IType type, CascadingAction action, CascadePoint cascadeTo ) ! // { ! // Cascade( session, child, type, action, cascadeTo, false ); ! // } /// <summary> *************** *** 309,348 **** /// <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) { ! if ( type.IsAssociationType ) { ! if ( ((IAssociationType)type).ForeignKeyType.CascadeNow(cascadeTo) ) { ! if ( type.IsEntityType || type.IsObjectType ) { ! action.Cascade(session, child); ! } ! else if ( type.IsPersistentCollectionType ) { CascadePoint cascadeVia; ! if ( cascadeTo == CascadePoint.CascadeAfterInsertBeforeDelete ) { cascadeVia = CascadePoint.CascadeAfterInsertBeforeDeleteViaCollection; ! } ! else { cascadeVia = cascadeTo; } ! PersistentCollectionType pctype = (PersistentCollectionType) type; CollectionPersister persister = session.Factory.GetCollectionPersister( pctype.Role ); IType elemType = persister.ElementType; ! // cascade to current collection elements ICollection iter; ! if (action.ShouldCascadeCollection(child)) { ! if ( log.IsDebugEnabled ) log.Debug( "cascading to collection: " + pctype.Role ); ! iter = pctype.GetElementsCollection(child); ! } ! else { //TODO: this hack assumes that shouldCascadeCollection() always --- 329,371 ---- /// <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 ) { ! if( type.IsAssociationType ) { ! if( ( ( IAssociationType ) type ).ForeignKeyType.CascadeNow( cascadeTo ) ) { ! if( type.IsEntityType || type.IsObjectType ) { ! action.Cascade( session, child ); ! } ! else if( type.IsPersistentCollectionType ) { CascadePoint cascadeVia; ! if( cascadeTo == CascadePoint.CascadeAfterInsertBeforeDelete ) { cascadeVia = CascadePoint.CascadeAfterInsertBeforeDeleteViaCollection; ! } ! else { cascadeVia = cascadeTo; } ! PersistentCollectionType pctype = ( PersistentCollectionType ) type; CollectionPersister persister = session.Factory.GetCollectionPersister( pctype.Role ); IType elemType = persister.ElementType; ! // cascade to current collection elements ICollection iter; ! if( action.ShouldCascadeCollection( child ) ) { ! if( log.IsDebugEnabled ) ! { ! log.Debug( "cascading to collection: " + pctype.Role ); ! } ! iter = pctype.GetElementsCollection( child ); ! } ! else { //TODO: this hack assumes that shouldCascadeCollection() always *************** *** 350,388 **** // of the semantics - what we need is to change // shouldCascadeCollection() to getCollectionCascadeIterator() ! if (child is PersistentCollection) { ! PersistentCollection pc = (PersistentCollection) child; ! if ( pc.HasQueuedAdds ) { iter = pc.QueuedAddsCollection; ! } ! else { iter = null; } ! } ! else { iter = null; } ! } ! if (iter!=null) { ! foreach(object obj in iter) { ! Cascade(session, obj, elemType, action, cascadeVia, false); } } // handle oprhaned entities!! ! if( deleteOrphans && action.DeleteOrphans() && child is PersistentCollection) { ! PersistentCollection pc = (PersistentCollection)child; ! if(pc.WasInitialized) { ! ICollection orphanColl = session.GetOrphans(pc); ! foreach(object obj in orphanColl) { ! session.Delete(obj); } } --- 373,411 ---- // of the semantics - what we need is to change // shouldCascadeCollection() to getCollectionCascadeIterator() ! if( child is PersistentCollection ) { ! PersistentCollection pc = ( PersistentCollection ) child; ! if( pc.HasQueuedAdds ) { iter = pc.QueuedAddsCollection; ! } ! else { iter = null; } ! } ! else { iter = null; } ! } ! if( iter != null ) { ! foreach( object obj in iter ) { ! Cascade( session, obj, elemType, action, cascadeVia, false ); } } // handle oprhaned entities!! ! if( deleteOrphans && action.DeleteOrphans() && child is PersistentCollection ) { ! PersistentCollection pc = ( PersistentCollection ) child; ! if( pc.WasInitialized ) { ! ICollection orphanColl = session.GetOrphans( pc ); ! foreach( object obj in orphanColl ) { ! session.Delete( obj ); } } *************** *** 390,403 **** } } ! } ! else if (type.IsComponentType ) { ! IAbstractComponentType ctype = ((IAbstractComponentType) type); ! object[] children = ctype.GetPropertyValues(child, session); ! IType[] types = ctype.Subtypes; ! for (int i=0; i<types.Length; i++) { ! if (ctype.Cascade(i).DoCascade(action) ) ! Cascade(session, children[i], types[i], action, cascadeTo, deleteOrphans); } } --- 413,428 ---- } } ! } ! else if( type.IsComponentType ) { ! IAbstractComponentType ctype = ( ( IAbstractComponentType ) type ); ! object[ ] children = ctype.GetPropertyValues( child, session ); ! IType[ ] types = ctype.Subtypes; ! for( int i = 0; i < types.Length; i++ ) { ! if( ctype.Cascade( i ).DoCascade( action ) ) ! { ! Cascade( session, children[ i ], types[ i ], action, cascadeTo, deleteOrphans ); ! } } } *************** *** 413,431 **** /// <param name="action"></param> /// <param name="cascadeTo"></param> ! public static void Cascade(ISessionImplementor session, IClassPersister persister, object parent, Cascades.CascadingAction action, CascadePoint cascadeTo) { ! if ( persister.HasCascades ) { ! if ( log.IsDebugEnabled ) log.Debug( "processing cascades for: " + persister.ClassName); ! IType[] types = persister.PropertyTypes; ! Cascades.CascadeStyle[] cascadeStyles = persister.PropertyCascadeStyles; ! for (int i=0; i<types.Length; i++) { ! if ( cascadeStyles[i].DoCascade(action) ) ! Cascade(session, persister.GetPropertyValue(parent, i), types[i], action, cascadeTo, cascadeStyles[i]==CascadeStyle.StyleAllGC ); } - if ( log.IsDebugEnabled ) log.Debug( "done processing cascades for: " + persister.ClassName ); } ! } } ! } ! --- 438,464 ---- /// <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 ) { ! if( log.IsDebugEnabled ) { ! log.Debug( "processing cascades for: " + persister.ClassName ); ! } ! IType[ ] types = persister.PropertyTypes; ! CascadeStyle[ ] cascadeStyles = persister.PropertyCascadeStyles; ! for( int i = 0; i < types.Length; i++ ) ! { ! if( cascadeStyles[ i ].DoCascade( action ) ) ! { ! Cascade( session, persister.GetPropertyValue( parent, i ), types[ i ], action, cascadeTo, cascadeStyles[ i ] == CascadeStyle.StyleAllGC ); ! } ! } ! if( log.IsDebugEnabled ) ! { ! log.Debug( "done processing cascades for: " + persister.ClassName ); } } ! } } ! } \ No newline at end of file Index: IBatcher.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/IBatcher.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IBatcher.cs 14 Sep 2004 17:49:54 -0000 1.4 --- IBatcher.cs 31 Dec 2004 17:36:22 -0000 1.5 *************** *** 1,8 **** using System; using System.Data; - using NHibernate.SqlCommand; ! namespace NHibernate.Engine { /// <summary> --- 1,7 ---- using System; using System.Data; using NHibernate.SqlCommand; ! namespace NHibernate.Engine { /// <summary> *************** *** 21,25 **** /// </para> /// </remarks> ! public interface IBatcher { /// <summary> --- 20,24 ---- /// </para> /// </remarks> ! public interface IBatcher { /// <summary> *************** *** 35,39 **** /// does NOT cause the batch to execute... /// </remarks> ! IDbCommand PrepareQueryCommand(SqlString sql, bool scrollable); /// <summary> --- 34,38 ---- /// does NOT cause the batch to execute... /// </remarks> ! IDbCommand PrepareQueryCommand( SqlString sql, bool scrollable ); /// <summary> *************** *** 43,47 **** /// <param name="cmd">The <see cref="IDbCommand"/> to close.</param> /// <param name="reader">The <see cref="IDataReader"/> to close.</param> ! void CloseQueryCommand(IDbCommand cmd, IDataReader reader); /// <summary> --- 42,46 ---- /// <param name="cmd">The <see cref="IDbCommand"/> to close.</param> /// <param name="reader">The <see cref="IDataReader"/> to close.</param> ! void CloseQueryCommand( IDbCommand cmd, IDataReader reader ); /// <summary> *************** *** 51,55 **** /// <param name="sql">The SqlString to convert to an IDbCommand.</param> /// <returns></returns> ! IDbCommand PrepareCommand(SqlString sql); /// <summary> --- 50,54 ---- /// <param name="sql">The SqlString to convert to an IDbCommand.</param> /// <returns></returns> ! IDbCommand PrepareCommand( SqlString sql ); /// <summary> *************** *** 58,62 **** /// <param name="cm">The <see cref="IDbCommand"/> to ensure is closed.</param> /// <param name="reader">The <see cref="IDataReader"/> to ensure is closed.</param> ! void CloseCommand(IDbCommand cm, IDataReader reader); /// <summary> --- 57,61 ---- /// <param name="cm">The <see cref="IDbCommand"/> to ensure is closed.</param> /// <param name="reader">The <see cref="IDataReader"/> to ensure is closed.</param> ! void CloseCommand( IDbCommand cm, IDataReader reader ); /// <summary> *************** *** 70,74 **** /// <param name="sql"></param> /// <returns></returns> ! IDbCommand PrepareBatchCommand(SqlString sql); /// <summary> --- 69,73 ---- /// <param name="sql"></param> /// <returns></returns> ! IDbCommand PrepareBatchCommand( SqlString sql ); /// <summary> *************** *** 81,85 **** /// expect. /// </remarks> ! void AddToBatch(int expectedRowCount); /// <summary> --- 80,84 ---- /// expect. /// </remarks> ! void AddToBatch( int expectedRowCount ); /// <summary> *************** *** 103,107 **** /// <see cref="IDataReader"/>s it can have are followed. /// </remarks> ! IDataReader ExecuteReader(IDbCommand cmd); /// <summary> --- 102,106 ---- /// <see cref="IDataReader"/>s it can have are followed. /// </remarks> ! IDataReader ExecuteReader( IDbCommand cmd ); /// <summary> *************** *** 113,117 **** /// The Batcher is responsible for ensuring that all of the Drivers rules for how many open /// <see cref="IDataReader"/>s it can have are followed. ! int ExecuteNonQuery(IDbCommand cmd); /// <summary> --- 112,117 ---- /// The Batcher is responsible for ensuring that all of the Drivers rules for how many open /// <see cref="IDataReader"/>s it can have are followed. ! /// </remarks> ! int ExecuteNonQuery( IDbCommand cmd ); /// <summary> *************** *** 119,123 **** /// </summary> /// <param name="e"></param> ! void AbortBatch(Exception e); /// <summary> --- 119,123 ---- /// </summary> /// <param name="e"></param> ! void AbortBatch( Exception e ); /// <summary> *************** *** 129,134 **** /// A wrapper for calling the <c>IDriver.GenerateCommand</c> that adds logging. /// </remarks> ! IDbCommand Generate(SqlString sqlString); } ! } --- 129,134 ---- /// A wrapper for calling the <c>IDriver.GenerateCommand</c> that adds logging. /// </remarks> ! IDbCommand Generate( SqlString sqlString ); } ! } \ No newline at end of file Index: ICollectionSnapshot.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/ICollectionSnapshot.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ICollectionSnapshot.cs 29 Nov 2004 04:45:51 -0000 1.4 --- ICollectionSnapshot.cs 31 Dec 2004 17:36:22 -0000 1.5 *************** *** 1,10 **** ! using System; ! ! namespace NHibernate.Engine { /// <summary> /// Defines a complete "snapshot" of a particular collection. /// </summary> ! public interface ICollectionSnapshot { /// <summary> --- 1,8 ---- ! namespace NHibernate.Engine { /// <summary> /// Defines a complete "snapshot" of a particular collection. /// </summary> ! public interface ICollectionSnapshot { /// <summary> *************** *** 12,21 **** /// </summary> object Key { get; } ! /// <summary> /// Gets the role that identifies this Collection. /// </summary> string Role { get; } ! /// <summary> /// Gets the snapshot copy of the Collection's elements. --- 10,19 ---- /// </summary> object Key { get; } ! /// <summary> /// Gets the role that identifies this Collection. /// </summary> string Role { get; } ! /// <summary> /// Gets the snapshot copy of the Collection's elements. *************** *** 28,32 **** /// <summary> ! /// Gets a <see cref="Boolean"/> indicating if some action has been performed on the /// actual collection instance that has modified it. /// </summary> --- 26,30 ---- /// <summary> ! /// Gets a <see cref="bool"/> indicating if some action has been performed on the /// actual collection instance that has modified it. /// </summary> *************** *** 39,46 **** /// <summary> ! /// Gets a <see cref="Boolean"/> indicating if the underlying collection has been /// initialized yet. /// </summary> ! bool IsInitialized{ get; } } ! } --- 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 |