You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(248) |
May
(82) |
Jun
(90) |
Jul
(177) |
Aug
(253) |
Sep
(157) |
Oct
(151) |
Nov
(143) |
Dec
(278) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(152) |
Feb
(107) |
Mar
(177) |
Apr
(133) |
May
(259) |
Jun
(81) |
Jul
(119) |
Aug
(306) |
Sep
(416) |
Oct
(240) |
Nov
(329) |
Dec
(206) |
2006 |
Jan
(466) |
Feb
(382) |
Mar
(153) |
Apr
(162) |
May
(133) |
Jun
(21) |
Jul
(18) |
Aug
(37) |
Sep
(97) |
Oct
(114) |
Nov
(110) |
Dec
(28) |
2007 |
Jan
(74) |
Feb
(65) |
Mar
(49) |
Apr
(76) |
May
(43) |
Jun
(15) |
Jul
(68) |
Aug
(55) |
Sep
(63) |
Oct
(59) |
Nov
(70) |
Dec
(66) |
2008 |
Jan
(71) |
Feb
(60) |
Mar
(120) |
Apr
(31) |
May
(48) |
Jun
(81) |
Jul
(107) |
Aug
(51) |
Sep
(80) |
Oct
(83) |
Nov
(83) |
Dec
(79) |
2009 |
Jan
(83) |
Feb
(110) |
Mar
(97) |
Apr
(91) |
May
(291) |
Jun
(250) |
Jul
(197) |
Aug
(58) |
Sep
(54) |
Oct
(122) |
Nov
(68) |
Dec
(34) |
2010 |
Jan
(50) |
Feb
(17) |
Mar
(63) |
Apr
(61) |
May
(84) |
Jun
(81) |
Jul
(138) |
Aug
(144) |
Sep
(78) |
Oct
(26) |
Nov
(30) |
Dec
(61) |
2011 |
Jan
(33) |
Feb
(35) |
Mar
(166) |
Apr
(221) |
May
(109) |
Jun
(76) |
Jul
(27) |
Aug
(37) |
Sep
(1) |
Oct
(4) |
Nov
(2) |
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2013 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(1) |
2014 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Paul H. <pha...@us...> - 2005-03-14 16:52:01
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4547/nhibernate/src/NHibernate/Impl Modified Files: BatchingBatcher.cs Log Message: Comment out batchSize for now as not used Index: BatchingBatcher.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/BatchingBatcher.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BatchingBatcher.cs 6 Mar 2005 12:44:43 -0000 1.1 --- BatchingBatcher.cs 14 Mar 2005 16:51:52 -0000 1.2 *************** *** 10,14 **** internal class BatchingBatcher : BatcherImpl { ! private int batchSize; private int[] expectedRowCounts; --- 10,14 ---- internal class BatchingBatcher : BatcherImpl { ! //private int batchSize; private int[] expectedRowCounts; |
From: Paul H. <pha...@us...> - 2005-03-14 15:01:11
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Transform In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7109/nhibernate/src/NHibernate/Transform Added Files: IResultTransformer.cs Log Message: --- NEW FILE: IResultTransformer.cs --- using System; using System.Collections; namespace NHibernate.Transform { /// <summary> /// Implementors define a strategy for transforming criteria query /// results into the actual application-visible query result list. /// </summary> /// <remarks>see NHibernate.Criteria#setResultTransformer(ResultTransformer)</remarks> public interface IResultTransformer { /// <summary> /// /// </summary> /// <param name="tuple"></param> /// <param name="aliases"></param> /// <returns></returns> object TransformTuple( object[] tuple, string[] aliases ); /// <summary> /// /// </summary> /// <param name="collection"></param> /// <returns></returns> IList TransformList( IList collection ); } } |
From: Paul H. <pha...@us...> - 2005-03-14 15:00:22
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6914/nhibernate/src/NHibernate/Cache Added Files: ILockable.cs Log Message: --- NEW FILE: ILockable.cs --- using System; namespace NHibernate.Cache { /// <summary> /// Summary description for ILockable. /// </summary> public interface ILockable { /// <summary> /// /// </summary> /// <param name="timeout"></param> /// <param name="id"></param> /// <returns></returns> ISoftLock Lock( long timeout, int id ); /// <summary> /// /// </summary> bool IsLock { get; } /// <summary> /// /// </summary> /// <param name="txTimestamp"></param> /// <returns></returns> bool IsGettable( long txTimestamp ); /// <summary> /// /// </summary> /// <param name="txTimestamp"></param> /// <param name="newVersion"></param> /// <returns></returns> bool IsPuttable( long txTimestamp, object newVersion ); // IComparator comparator ); } } |
From: Paul H. <pha...@us...> - 2005-03-14 14:57:59
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6214/nhibernate/src/NHibernate/Cache Modified Files: ICacheConcurrencyStrategy.cs NonstrictReadWriteCache.cs ReadOnlyCache.cs ReadWriteCache.cs Log Message: Bring cache up to 2.1 compliance Index: ReadWriteCache.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/ReadWriteCache.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ReadWriteCache.cs 6 Mar 2005 12:44:35 -0000 1.9 --- ReadWriteCache.cs 14 Mar 2005 14:57:33 -0000 1.10 *************** *** 200,203 **** --- 200,275 ---- } + /// <summary> + /// + /// </summary> + /// <param name="key"></param> + /// <param name="value"></param> + /// <param name="version"></param> + /// <param name="lock"></param> + public void AfterUpdate( object key, object value, object version, ISoftLock @lock ) + { + lock( lockObject ) + { + if( log.IsDebugEnabled ) + { + log.Debug( "Updating: " + key ); + } + + _cache.Put( key, new CachedItem( value ) ); + + if( log.IsDebugEnabled ) + { + log.Debug( "Updating: " + key ); + } + } + } + + /// <summary> + /// + /// </summary> + /// <param name="key"></param> + /// <param name="value"></param> + /// <param name="version"></param> + public void AfterInsert( object key, object value, object version ) + { + lock( lockObject ) + { + if( log.IsDebugEnabled ) + { + log.Debug( "Inserting: " + key ); + } + + _cache.Put( key, new CachedItem( value ) ); + } + } + + /// <summary> + /// + /// </summary> + /// <param name="key"></param> + public void Evict( object key ) + { + // NOOP + } + + /// <summary> + /// + /// </summary> + /// <param name="key"></param> + /// <param name="value"></param> + public void Insert( object key, object value ) + { + // NOOP + } + + /// <summary> + /// + /// </summary> + /// <param name="key"></param> + /// <param name="value"></param> + public void Update( object key, object value ) + { + // NOOP + } #endregion } Index: NonstrictReadWriteCache.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/NonstrictReadWriteCache.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** NonstrictReadWriteCache.cs 6 Mar 2005 12:44:35 -0000 1.6 --- NonstrictReadWriteCache.cs 14 Mar 2005 14:57:33 -0000 1.7 *************** *** 132,135 **** --- 132,148 ---- } + /// <summary> + /// + /// </summary> + /// <param name="key"></param> + public void Evict( object key ) + { + if( log.IsDebugEnabled ) + { + log.Debug( "Evicting: " + key ); + } + _cache.Remove( key ); + } + /// <summary></summary> public void Clear() *************** *** 155,158 **** --- 168,191 ---- } + /// <summary> + /// + /// </summary> + /// <param name="key"></param> + /// <param name="value"></param> + public void Update( object key, object value ) + { + Evict( key ); + } + + /// <summary> + /// + /// </summary> + /// <param name="key"></param> + /// <param name="value"></param> + public void Insert( object key, object value ) + { + // Do nothing; + } + /// <summary></summary> public ICache Cache *************** *** 162,165 **** --- 195,220 ---- } + /// <summary> + /// Invalidate the item (again, for safety). + /// </summary> + /// <param name="key"></param> + /// <param name="value"></param> + /// <param name="version"></param> + /// <param name="lock"></param> + public void AfterUpdate( object key, object value, object version, ISoftLock @lock ) + { + Release( key, @lock ); + } + + /// <summary> + /// + /// </summary> + /// <param name="key"></param> + /// <param name="value"></param> + /// <param name="version"></param> + public void AfterInsert( object key, object value, object version ) + { + // Do nothing + } #endregion } Index: ReadOnlyCache.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/ReadOnlyCache.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ReadOnlyCache.cs 6 Mar 2005 12:44:35 -0000 1.10 --- ReadOnlyCache.cs 14 Mar 2005 14:57:33 -0000 1.11 *************** *** 132,135 **** --- 132,188 ---- } + /// <summary> + /// + /// </summary> + /// <param name="key"></param> + /// <param name="value"></param> + /// <param name="version"></param> + /// <param name="lock"></param> + public void AfterUpdate( object key, object value, object version, ISoftLock @lock ) + { + log.Error( "Application attempted to edit read only item: " + key ); + throw new InvalidOperationException( "Can't write to a readonly object" ); + } + + /// <summary> + /// + /// </summary> + /// <param name="key"></param> + /// <param name="value"></param> + /// <param name="version"></param> + public void AfterInsert( object key, object value, object version ) + { + // Ignore + } + + /// <summary> + /// + /// </summary> + /// <param name="key"></param> + public void Evict( object key ) + { + // NOOP + } + + /// <summary> + /// + /// </summary> + /// <param name="key"></param> + /// <param name="value"></param> + public void Insert( object key, object value ) + { + // NOOP + } + + /// <summary> + /// + /// </summary> + /// <param name="key"></param> + /// <param name="value"></param> + public void Update( object key, object value ) + { + log.Error( "Application attempted to edit read only item: " + key ); + throw new InvalidOperationException( "Can't write to a readonly object" ); + } #endregion } Index: ICacheConcurrencyStrategy.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/ICacheConcurrencyStrategy.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ICacheConcurrencyStrategy.cs 6 Mar 2005 12:44:34 -0000 1.7 --- ICacheConcurrencyStrategy.cs 14 Mar 2005 14:57:32 -0000 1.8 *************** *** 26,30 **** /// <summary> ! /// Attempt to Cache an object /// </summary> /// <param name="key">The key (id) of the object to put in the Cache.</param> --- 26,30 ---- /// <summary> ! /// Attempt to cache an object, after loading from the database /// </summary> /// <param name="key">The key (id) of the object to put in the Cache.</param> *************** *** 45,48 **** --- 45,68 ---- /// <summary> + /// Called after an item has become stale (before the transaction completes). + /// </summary> + /// <param name="key"></param> + void Evict( object key ); + + /// <summary> + /// Called after an item has been updated (before the transaction completes), instead of calling Evict(). + /// </summary> + /// <param name="key"></param> + /// <param name="value"></param> + void Update( object key, object value ); + + /// <summary> + /// Called after an item has been inserted (before the transaction completes), instead of calling Evict(). + /// </summary> + /// <param name="key"></param> + /// <param name="value"></param> + void Insert( object key, object value ); + + /// <summary> /// We have finished the attempted update/delete (which may or may not have been successful) /// </summary> *************** *** 52,56 **** void Release( object key, ISoftLock @lock ); - /* /// <summary> /// Called after an item has been updated (after the transaction completes), instead of calling Release(). --- 72,75 ---- *************** *** 59,65 **** /// <param name="value"></param> /// <param name="version"></param> ! /// <param name="?"></param> /// <remarks>This method is used by "asynchronous" concurrency strategies.</remarks> ! void AfterUpdate(object key, object value, object version, SoftLock lock) throws CacheException; /// <summary> --- 78,84 ---- /// <param name="value"></param> /// <param name="version"></param> ! /// <param name="lock"></param> /// <remarks>This method is used by "asynchronous" concurrency strategies.</remarks> ! void AfterUpdate(object key, object value, object version, ISoftLock @lock ); /// <summary> *************** *** 70,78 **** /// <param name="version"></param> /// <remarks>This method is used by "asynchronous" concurrency strategies.</remarks> ! public void AfterInsert(object key, object value, object version) throws CacheException; ! */ /// <summary> ! /// /// </summary> /// <param name="key"></param> --- 89,96 ---- /// <param name="version"></param> /// <remarks>This method is used by "asynchronous" concurrency strategies.</remarks> ! void AfterInsert(object key, object value, object version ); /// <summary> ! /// Evict an item from the cache immediately (without regard for transaction isolation). /// </summary> /// <param name="key"></param> *************** *** 81,85 **** /// <summary> ! /// /// </summary> /// <exception cref="CacheException"></exception> --- 99,103 ---- /// <summary> ! /// Evict all items from the cache immediately. /// </summary> /// <exception cref="CacheException"></exception> *************** *** 87,91 **** /// <summary> ! /// /// </summary> /// <exception cref="CacheException"></exception> --- 105,109 ---- /// <summary> ! /// Clean up all resources. /// </summary> /// <exception cref="CacheException"></exception> |
From: Paul H. <pha...@us...> - 2005-03-14 14:38:18
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv726/nhibernate/src/NHibernate/Util Modified Files: ReflectHelper.cs Log Message: Modified type reflector to take access strategy - speeds up mapping loading by avoiding unnecessary exceptions Index: ReflectHelper.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Util/ReflectHelper.cs,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** ReflectHelper.cs 1 Mar 2005 16:24:50 -0000 1.23 --- ReflectHelper.cs 14 Mar 2005 14:37:59 -0000 1.24 *************** *** 50,86 **** } - //TODO: most calls to this will be replaced by the Mapping.Property.GetGetter() but - // there will still be a call from hql into this. /// <summary> /// Finds the <see cref="IGetter"/> for the property in the <see cref="System.Type"/>. /// </summary> ! /// <param name="theClass">The <see cref="System.Type"/> to find the Property/Field in.</param> ! /// <param name="propertyName">The name of the Property/Field to find.</param> ! /// <returns>The <see cref="IGetter"/> for the property.</returns> /// <remarks> ! /// <para> ! /// This does not use the <c>access=""</c> attribute specified in the mapping. It ! /// first checks to see if there is a Property in your class with the same name. If ! /// no Property is found then it moves through each <see cref="IPropertyAccessor"/> strategy ! /// and tries to find an <see cref="IGetter"/> through them. ! /// </para> /// </remarks> ! /// <exception cref="PropertyNotFoundException"> ! /// No Property or Field with the <c>propertyName</c> could be found. ! /// </exception> ! public static IGetter GetGetter( System.Type theClass, string propertyName ) { IPropertyAccessor accessor = null; - // first try the basicPropertyAccessor since that will be the most likely - // strategy used. try { ! accessor = ( IPropertyAccessor ) PropertyAccessorFactory.PropertyAccessors[ "property" ]; return accessor.GetGetter( theClass, propertyName ); } catch( PropertyNotFoundException ) { ! // the basic "property" strategy did not work so try the rest of them foreach( DictionaryEntry de in PropertyAccessorFactory.PropertyAccessors ) { --- 50,76 ---- } /// <summary> /// Finds the <see cref="IGetter"/> for the property in the <see cref="System.Type"/>. /// </summary> ! /// <param name="theClass"></param> ! /// <param name="propertyName"></param> ! /// <param name="propertyAccessorName"></param> ! /// <returns></returns> /// <remarks> ! /// This one takes a propertyAccessor name as we might know the correct strategy by now so we avoid Exceptions which are costly /// </remarks> ! public static IGetter GetGetter( System.Type theClass, string propertyName, string propertyAccessorName ) { IPropertyAccessor accessor = null; try { ! // first try the named strategy since that will be the most likely strategy used. ! accessor = ( IPropertyAccessor ) PropertyAccessorFactory.PropertyAccessors[ propertyAccessorName ]; return accessor.GetGetter( theClass, propertyName ); } catch( PropertyNotFoundException ) { ! // the basic named strategy did not work so try the rest of them foreach( DictionaryEntry de in PropertyAccessorFactory.PropertyAccessors ) { *************** *** 95,105 **** // the rest of the accessor strategies. } - } - throw; } } //TODO: add a method in here ReflectedPropertyClass and replace most calls to GetGetter // with calls to it --- 85,118 ---- // the rest of the accessor strategies. } } throw; } } + //TODO: most calls to this will be replaced by the Mapping.Property.GetGetter() but + // there will still be a call from hql into this. + /// <summary> + /// Finds the <see cref="IGetter"/> for the property in the <see cref="System.Type"/>. + /// </summary> + /// <param name="theClass">The <see cref="System.Type"/> to find the Property/Field in.</param> + /// <param name="propertyName">The name of the Property/Field to find.</param> + /// <returns>The <see cref="IGetter"/> for the property.</returns> + /// <remarks> + /// <para> + /// This does not use the <c>access=""</c> attribute specified in the mapping. It + /// first checks to see if there is a Property in your class with the same name. If + /// no Property is found then it moves through each <see cref="IPropertyAccessor"/> strategy + /// and tries to find an <see cref="IGetter"/> through them. + /// </para> + /// </remarks> + /// <exception cref="PropertyNotFoundException"> + /// No Property or Field with the <c>propertyName</c> could be found. + /// </exception> + public static IGetter GetGetter( System.Type theClass, string propertyName ) + { + // first try the basicPropertyAccessor since that will be the most likely strategy used. + return GetGetter( theClass, propertyName, "property" ); + } + //TODO: add a method in here ReflectedPropertyClass and replace most calls to GetGetter // with calls to it *************** *** 111,120 **** /// <param name="theClass">The <see cref="System.Type"/> to find the Property in.</param> /// <param name="name">The name of the property/field to find in the class.</param> /// <returns> /// The NHibernate <see cref="IType"/> for the named property. /// </returns> ! public static IType ReflectedPropertyType( System.Type theClass, string name ) { ! return TypeFactory.HueristicType( GetGetter( theClass, name ).ReturnType.AssemblyQualifiedName ); } --- 124,134 ---- /// <param name="theClass">The <see cref="System.Type"/> to find the Property in.</param> /// <param name="name">The name of the property/field to find in the class.</param> + /// <param name="propertyAccess"></param> /// <returns> /// The NHibernate <see cref="IType"/> for the named property. /// </returns> ! public static IType ReflectedPropertyType( System.Type theClass, string name, string propertyAccess ) { ! return TypeFactory.HueristicType( GetGetter( theClass, name, propertyAccess ).ReturnType.AssemblyQualifiedName ); } |
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32738/nhibernate/src/NHibernate/Mapping Modified Files: Any.cs Array.cs Bag.cs Collection.cs Column.cs Component.cs Constraint.cs ForeignKey.cs Formula.cs IRelationalModel.cs IdentifierBag.cs IdentifierCollection.cs Index.cs List.cs ManyToOne.cs Map.cs OneToOne.cs PrimaryKey.cs Property.cs RootClass.cs Set.cs SimpleValue.cs Table.cs ToOne.cs UniqueKey.cs Log Message: Bringing mapping/config to 2.1 feature set - excludes metaData Index: ManyToOne.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/ManyToOne.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ManyToOne.cs 1 Mar 2005 16:24:49 -0000 1.5 --- ManyToOne.cs 14 Mar 2005 14:36:26 -0000 1.6 *************** *** 20,24 **** /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName ) { try --- 20,25 ---- /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! /// <param name="propertyAccess"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName, string propertyAccess ) { try *************** *** 26,30 **** if( Type == null ) { ! Type = TypeFactory.ManyToOne( ReflectHelper.GetGetter( propertyClass, propertyName ).ReturnType ); } } --- 27,31 ---- if( Type == null ) { ! Type = TypeFactory.ManyToOne( ReflectHelper.GetGetter( propertyClass, propertyName, propertyAccess ).ReturnType ); } } Index: Map.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Map.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Map.cs 1 Mar 2005 16:24:49 -0000 1.8 --- Map.cs 14 Mar 2005 14:36:26 -0000 1.9 *************** *** 26,36 **** /// <summary></summary> ! public override System.Type WrapperClass { ! get { ! return IsSorted ? ! typeof( NHibernate.Collection.SortedMap ) : ! typeof( NHibernate.Collection.Map ); } } --- 26,35 ---- /// <summary></summary> ! public override void CreateAllKeys( ) { ! base.CreateAllKeys(); ! if ( !IsInverse ) { ! Index.CreateForeignKey(); } } Index: Formula.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Formula.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Formula.cs 2 Jan 2005 22:03:39 -0000 1.5 --- Formula.cs 14 Mar 2005 14:36:26 -0000 1.6 *************** *** 11,15 **** private string formula; - private int uniqueInteger; --- 11,14 ---- Index: Property.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Property.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Property.cs 8 Mar 2005 16:49:24 -0000 1.12 --- Property.cs 14 Mar 2005 14:36:26 -0000 1.13 *************** *** 112,115 **** --- 112,117 ---- else if( cascade.Equals( "all-delete-orphan" ) ) { + // TODO: 2.1 - Reintroduce when Loader porting completed + //return Cascades.CascadeStyle.StyleAllDeleteOrphan; return Cascades.CascadeStyle.StyleAllGC; } *************** *** 126,129 **** --- 128,137 ---- return Cascades.CascadeStyle.StyleOnlyDelete; } + else if( cascade.Equals( "delete-orphan" ) ) + { + // TODO: 2.1 - Reintroduce when Loader porting completed + //return Cascades.CascadeStyle.StyleDeleteOrphan; + return Cascades.CascadeStyle.StyleOnlyDelete; + } else { *************** *** 163,168 **** public bool IsNullable { ! // Approximate ! get { return propertyValue != null && propertyValue.IsNullable; } } --- 171,175 ---- public bool IsNullable { ! get { return propertyValue == null || propertyValue.IsNullable; } } Index: Column.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Column.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Column.cs 19 Feb 2005 15:13:52 -0000 1.17 --- Column.cs 14 Mar 2005 14:36:26 -0000 1.18 *************** *** 17,21 **** private int length = DefaultPropertyLength; private IType type; ! private int typeIndex; private string name; private bool nullable = true; --- 17,21 ---- private int length = DefaultPropertyLength; private IType type; ! private int typeIndex = 0; private string name; private bool nullable = true; *************** *** 23,26 **** --- 23,27 ---- private string sqlType; private bool quoted = false; + private string checkConstraint; /// <summary></summary> *************** *** 111,115 **** public string Alias( Dialect.Dialect d ) { ! if( quoted ) { return "y" + uniqueInteger.ToString() + StringHelper.Underscore; --- 112,116 ---- public string Alias( Dialect.Dialect d ) { ! if( quoted || name[0] == StringHelper.SingleQuote || char.IsDigit( name, 0 ) ) { return "y" + uniqueInteger.ToString() + StringHelper.Underscore; *************** *** 136,140 **** public string Alias( Dialect.Dialect d, string suffix ) { ! if( quoted ) { return "y" + uniqueInteger.ToString() + StringHelper.Underscore; --- 137,141 ---- public string Alias( Dialect.Dialect d, string suffix ) { ! if( quoted || name[0] == StringHelper.SingleQuote || char.IsDigit( name, 0 ) ) { return "y" + uniqueInteger.ToString() + StringHelper.Underscore; *************** *** 322,325 **** --- 323,351 ---- } + /// <summary> + /// Gets or sets whether the column is unique. + /// </summary> + public bool Unique + { + get { return unique; } + set { unique = value; } + } + + /// <summary> + /// Gets or sets a check constraint on the column + /// </summary> + public string CheckConstraint + { + get { return checkConstraint; } + set { checkConstraint = value; } + } + + /// <summary> + /// Do we have a check constraint? + /// </summary> + public bool HasCheckConstraint + { + get { return checkConstraint != null && checkConstraint.Length > 0; } + } } } \ No newline at end of file Index: Collection.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Collection.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Collection.cs 1 Mar 2005 16:24:49 -0000 1.8 --- Collection.cs 14 Mar 2005 14:36:26 -0000 1.9 *************** *** 23,29 **** private string role; private bool lazy; - //private bool isOneToMany; private bool inverse; - //private OneToMany oneToMany; private ICacheConcurrencyStrategy cache; private string orderBy; --- 23,27 ---- *************** *** 167,173 **** /// <summary></summary> - public abstract System.Type WrapperClass { get; } - - /// <summary></summary> public virtual bool IsPrimitiveArray { --- 165,168 ---- *************** *** 191,206 **** { get { return element is OneToMany; } - //set { isOneToMany = value; } } - /* - /// <summary></summary> - public OneToMany OneToMany - { - get { return oneToMany; } - set { oneToMany = value; } - } - */ - /// <summary></summary> public ICacheConcurrencyStrategy Cache --- 186,191 ---- *************** *** 282,286 **** /// /// </summary> ! public void CreateAllKeys() { CreateForeignKeys(); --- 267,271 ---- /// /// </summary> ! public virtual void CreateAllKeys() { CreateForeignKeys(); Index: RootClass.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/RootClass.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** RootClass.cs 1 Mar 2005 16:24:49 -0000 1.13 --- RootClass.cs 14 Mar 2005 14:36:26 -0000 1.14 *************** *** 3,6 **** --- 3,7 ---- using log4net; using NHibernate.Cache; + using NHibernate.Engine; using NHibernate.Persister; *************** *** 38,42 **** private bool forceDiscriminator; private string where; ! private bool discriminatorInsertable; /// <summary> --- 39,43 ---- private bool forceDiscriminator; private string where; ! private bool discriminatorInsertable = true; /// <summary> *************** *** 319,322 **** --- 320,336 ---- set { discriminatorInsertable = value; } } + + /// <summary> + /// + /// </summary> + /// <param name="mapping"></param> + public override void Validate( IMapping mapping ) + { + base.Validate( mapping ); + if ( !Identifier.IsValid( mapping ) ) + { + throw new MappingException( string.Format( "identifier mapping has wrong number of columns: {0} type: {1}", MappedClass.Name, Identifier.Type.Name ) ); + } + } } } \ No newline at end of file Index: Constraint.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Constraint.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Constraint.cs 9 Feb 2005 03:09:38 -0000 1.7 --- Constraint.cs 14 Mar 2005 14:36:26 -0000 1.8 *************** *** 77,86 **** /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <returns> /// A string that contains the SQL to drop this Constraint. /// </returns> ! public virtual string SqlDropString( Dialect.Dialect dialect ) { ! return "alter table " + Table.GetQualifiedName( dialect ) + " drop constraint " + Name; } --- 77,88 ---- /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to drop this Constraint. /// </returns> ! public virtual string SqlDropString( Dialect.Dialect dialect, string defaultSchema ) { ! // TODO: NH 1.0+ - Get this string from the dialect ! return string.Format( "alter table {0} drop constraint {1}", Table.GetQualifiedName( dialect, defaultSchema ), Name ); } *************** *** 90,102 **** /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="p"></param> /// <returns> /// A string that contains the SQL to create this Constraint. /// </returns> ! public string SqlCreateString( Dialect.Dialect dialect, IMapping p ) { ! StringBuilder buf = new StringBuilder( "alter table " ) ! .Append( Table.GetQualifiedName( dialect ) ) ! .Append( SqlConstraintString( dialect, Name ) ); ! return buf.ToString(); } --- 92,103 ---- /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="p"></param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to create this Constraint. /// </returns> ! public string SqlCreateString( Dialect.Dialect dialect, IMapping p, string defaultSchema ) { ! // TODO: NH 1.0+ - Get this string from the dialect ! return string.Format( "alter table {0} {1} ", Table.GetQualifiedName( dialect, defaultSchema ), SqlConstraintString( dialect, Name, defaultSchema ) ); } *************** *** 109,116 **** /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="constraintName">The name to use as the identifier of the constraint in the database.</param> /// <returns> /// A string that contains the SQL to create the named Constraint. /// </returns> ! public abstract string SqlConstraintString( Dialect.Dialect d, string constraintName ); } --- 110,118 ---- /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="constraintName">The name to use as the identifier of the constraint in the database.</param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to create the named Constraint. /// </returns> ! public abstract string SqlConstraintString( Dialect.Dialect d, string constraintName, string defaultSchema ); } Index: ToOne.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/ToOne.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ToOne.cs 1 Mar 2005 16:24:49 -0000 1.1 --- ToOne.cs 14 Mar 2005 14:36:26 -0000 1.2 *************** *** 43,47 **** /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! public abstract override void SetTypeByReflection( System.Type propertyClass, string propertyName ); } } --- 43,48 ---- /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! /// <param name="propertyAccess"></param> ! public abstract override void SetTypeByReflection( System.Type propertyClass, string propertyName, string propertyAccess ); } } Index: PrimaryKey.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/PrimaryKey.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PrimaryKey.cs 9 Feb 2005 03:09:39 -0000 1.8 --- PrimaryKey.cs 14 Mar 2005 14:36:26 -0000 1.9 *************** *** 13,20 **** /// </summary> /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <returns> /// A string that contains the SQL to create the Primary Key Constraint. /// </returns> ! public string SqlConstraintString( Dialect.Dialect d ) { StringBuilder buf = new StringBuilder( " primary key (" ); --- 13,21 ---- /// </summary> /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to create the Primary Key Constraint. /// </returns> ! public string SqlConstraintString( Dialect.Dialect d, string defaultSchema ) { StringBuilder buf = new StringBuilder( " primary key (" ); *************** *** 37,44 **** /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="constraintName">The name to use as the identifier of the constraint in the database.</param> /// <returns> /// A string that contains the SQL to create the named Primary Key Constraint. /// </returns> ! public override string SqlConstraintString( Dialect.Dialect d, string constraintName ) { StringBuilder buf = new StringBuilder( --- 38,46 ---- /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="constraintName">The name to use as the identifier of the constraint in the database.</param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to create the named Primary Key Constraint. /// </returns> ! public override string SqlConstraintString( Dialect.Dialect d, string constraintName, string defaultSchema ) { StringBuilder buf = new StringBuilder( *************** *** 64,73 **** /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> ! /// <returns> /// A string that contains the SQL to drop this Constraint. /// </returns> ! public override string SqlDropString(NHibernate.Dialect.Dialect dialect) { ! return "alter table " + Table.GetQualifiedName( dialect ) + dialect.GetDropPrimaryKeyConstraintString( Name ); } #endregion --- 66,76 ---- /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> ! /// <param name="defaultSchema"></param> ! /// <returns> /// A string that contains the SQL to drop this Constraint. /// </returns> ! public override string SqlDropString(NHibernate.Dialect.Dialect dialect, string defaultSchema ) { ! return "alter table " + Table.GetQualifiedName( dialect, defaultSchema ) + dialect.GetDropPrimaryKeyConstraintString( Name ); } #endregion Index: IRelationalModel.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/IRelationalModel.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IRelationalModel.cs 2 Jan 2005 22:03:39 -0000 1.4 --- IRelationalModel.cs 14 Mar 2005 14:36:26 -0000 1.5 *************** *** 14,21 **** /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="p"></param> /// <returns> /// A string that contains the SQL to create an object. /// </returns> ! string SqlCreateString( Dialect.Dialect dialect, IMapping p ); /// <summary> --- 14,22 ---- /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="p"></param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to create an object. /// </returns> ! string SqlCreateString( Dialect.Dialect dialect, IMapping p, string defaultSchema ); /// <summary> *************** *** 24,31 **** /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <returns> /// A string that contains the SQL to drop an object. /// </returns> ! string SqlDropString( Dialect.Dialect dialect ); } } \ No newline at end of file --- 25,33 ---- /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to drop an object. /// </returns> ! string SqlDropString( Dialect.Dialect dialect, string defaultSchema ); } } \ No newline at end of file Index: Component.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Component.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Component.cs 1 Mar 2005 16:24:49 -0000 1.7 --- Component.cs 14 Mar 2005 14:36:26 -0000 1.8 *************** *** 9,18 **** private ArrayList properties = new ArrayList(); private System.Type componentClass; - // TODO: H2.0.3 - make sure this is gone from the mapping file... - //private BasicDynaClass dynaClass - private bool dynamic; private bool embedded; private string parentProperty; private PersistentClass owner; /// <summary></summary> --- 9,16 ---- private ArrayList properties = new ArrayList(); private System.Type componentClass; private bool embedded; private string parentProperty; private PersistentClass owner; + private bool dynamic; /// <summary></summary> *************** *** 97,101 **** /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName ) { } --- 95,100 ---- /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! /// <param name="propertyAccess"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName, string propertyAccess ) { } *************** *** 116,125 **** /// <summary></summary> - public override bool IsComposite - { - get { return true; } - } - - /// <summary></summary> public System.Type ComponentClass { --- 115,118 ---- *************** *** 147,152 **** get { return properties; } } - - } } \ No newline at end of file --- 140,143 ---- Index: OneToOne.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/OneToOne.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** OneToOne.cs 1 Mar 2005 16:24:49 -0000 1.5 --- OneToOne.cs 14 Mar 2005 14:36:26 -0000 1.6 *************** *** 27,31 **** /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName ) { try --- 27,32 ---- /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! /// <param name="propertyAccess"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName, string propertyAccess ) { try *************** *** 33,37 **** if( Type == null ) { ! Type = TypeFactory.OneToOne( ReflectHelper.GetGetter( propertyClass, propertyName ).ReturnType, foreignKeyType ); } } --- 34,38 ---- if( Type == null ) { ! Type = TypeFactory.OneToOne( ReflectHelper.GetGetter( propertyClass, propertyName, propertyAccess ).ReturnType, foreignKeyType ); } } *************** *** 48,51 **** --- 49,53 ---- if( constrained ) { + // TODO: 2.1+ handle the case of a foreign key to something other than the pk CreateForeignKeyOfClass( ( ( EntityType ) Type ).AssociatedClass ); } Index: UniqueKey.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/UniqueKey.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** UniqueKey.cs 9 Feb 2005 03:09:39 -0000 1.8 --- UniqueKey.cs 14 Mar 2005 14:36:26 -0000 1.9 *************** *** 41,48 **** /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="constraintName"></param> /// <returns> /// A string that contains the SQL to create the Unique Key Constraint. /// </returns> ! public override string SqlConstraintString( Dialect.Dialect d, string constraintName ) { StringBuilder buf = new StringBuilder( --- 41,49 ---- /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="constraintName"></param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to create the Unique Key Constraint. /// </returns> ! public override string SqlConstraintString( Dialect.Dialect d, string constraintName, string defaultSchema ) { StringBuilder buf = new StringBuilder( *************** *** 73,82 **** /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> ! /// <returns> /// A string that contains the SQL to drop this Constraint. /// </returns> ! public override string SqlDropString(NHibernate.Dialect.Dialect dialect) { ! return "alter table " + Table.GetQualifiedName( dialect ) + dialect.GetDropIndexConstraintString( Name ); } --- 74,84 ---- /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> ! /// <param name="defaultSchema"></param> ! /// <returns> /// A string that contains the SQL to drop this Constraint. /// </returns> ! public override string SqlDropString(NHibernate.Dialect.Dialect dialect, string defaultSchema ) { ! return "alter table " + Table.GetQualifiedName( dialect, defaultSchema ) + dialect.GetDropIndexConstraintString( Name ); } Index: Any.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Any.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Any.cs 1 Mar 2005 16:24:48 -0000 1.6 --- Any.cs 14 Mar 2005 14:36:26 -0000 1.7 *************** *** 45,49 **** /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName ) { } --- 45,50 ---- /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! /// <param name="propertyAccess"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName, string propertyAccess ) { } Index: Set.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Set.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Set.cs 1 Mar 2005 16:24:49 -0000 1.8 --- Set.cs 14 Mar 2005 14:36:26 -0000 1.9 *************** *** 39,55 **** } - /// <summary> - /// <see cref="Collection.WrapperClass"/> - /// </summary> - public override System.Type WrapperClass - { - get - { - return IsSorted ? - typeof( NHibernate.Collection.SortedSet ) : - typeof( NHibernate.Collection.Set ); - } - } - /// <summary></summary> public override void CreatePrimaryKey() --- 39,42 ---- Index: IdentifierCollection.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/IdentifierCollection.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IdentifierCollection.cs 1 Mar 2005 16:24:49 -0000 1.4 --- IdentifierCollection.cs 14 Mar 2005 14:36:26 -0000 1.5 *************** *** 1,2 **** --- 1,4 ---- + using NHibernate.Engine; + namespace NHibernate.Mapping { *************** *** 44,50 **** } //else // Create an index on the key columns? - } } } \ No newline at end of file --- 46,63 ---- } //else // Create an index on the key columns? } + /// <summary> + /// + /// </summary> + /// <param name="mapping"></param> + public override void Validate( IMapping mapping ) + { + base.Validate( mapping ); + if ( !Identifier.IsValid( mapping ) ) + { + throw new MappingException( string.Format( "collection id mapping has wrong number of columns: {0} type: {1}", Role, Identifier.Type.Name ) ); + } + } } } \ No newline at end of file Index: SimpleValue.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/SimpleValue.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SimpleValue.cs 1 Mar 2005 16:24:49 -0000 1.1 --- SimpleValue.cs 14 Mar 2005 14:36:26 -0000 1.2 *************** *** 113,118 **** public void CreateForeignKeyOfClass( System.Type persistentClass ) { ! ForeignKey fk = table.CreateForeignKey( ConstraintColumns ); ! fk.ReferencedClass = persistentClass; } --- 113,117 ---- public void CreateForeignKeyOfClass( System.Type persistentClass ) { ! table.CreateForeignKey( ForeignKeyName, ConstraintColumns, persistentClass ); } *************** *** 137,141 **** /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! public virtual void SetTypeByReflection( System.Type propertyClass, string propertyName ) { try --- 136,151 ---- /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! public void SetTypeByReflection( System.Type propertyClass, string propertyName ) ! { ! SetTypeByReflection( propertyClass, propertyName, "property" ); ! } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="propertyClass"></param> ! /// <param name="propertyName"></param> ! /// <param name="propertyAccess"></param> ! public virtual void SetTypeByReflection( System.Type propertyClass, string propertyName, string propertyAccess ) { try *************** *** 143,147 **** if( type == null ) { ! type = ReflectHelper.ReflectedPropertyType( propertyClass, propertyName ); int count = 0; foreach( Column col in ColumnCollection ) --- 153,157 ---- if( type == null ) { ! type = ReflectHelper.ReflectedPropertyType( propertyClass, propertyName, propertyAccess ); int count = 0; foreach( Column col in ColumnCollection ) Index: Index.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Index.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Index.cs 2 Jan 2005 22:03:39 -0000 1.6 --- Index.cs 14 Mar 2005 14:36:26 -0000 1.7 *************** *** 20,28 **** /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="p"></param> /// <returns> /// A string that contains the SQL to create this Index. /// </returns> ! public string SqlCreateString( Dialect.Dialect dialect, IMapping p ) { StringBuilder buf = new StringBuilder( "create index " ) .Append( dialect.QualifyIndexName ? name : StringHelper.Unqualify( name ) ) --- 20,30 ---- /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="p"></param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to create this Index. /// </returns> ! public string SqlCreateString( Dialect.Dialect dialect, IMapping p, string defaultSchema ) { + // TODO: NH 1.0+ Get these string from the dialect StringBuilder buf = new StringBuilder( "create index " ) .Append( dialect.QualifyIndexName ? name : StringHelper.Unqualify( name ) ) *************** *** 51,60 **** /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <returns> /// A string that contains the SQL to drop this Index. /// </returns> ! public string SqlDropString( Dialect.Dialect dialect ) { ! return "drop index " + table.GetQualifiedName( dialect ) + StringHelper.Dot + name; } --- 53,64 ---- /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to drop this Index. /// </returns> ! public string SqlDropString( Dialect.Dialect dialect, string defaultSchema ) { ! // TODO: NH 1.0+ Get this string from the dialect ! return string.Format( "drop index {0}.{1}", table.GetQualifiedName( dialect, defaultSchema ), name ); } Index: Array.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Array.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Array.cs 1 Mar 2005 16:24:49 -0000 1.5 --- Array.cs 14 Mar 2005 14:36:26 -0000 1.6 *************** *** 33,48 **** /// <summary></summary> - public override System.Type WrapperClass - { - get { return typeof( ArrayHolder ); } - } - - /// <summary></summary> public override bool IsArray { get { return true; } } - - } } \ No newline at end of file --- 33,40 ---- Index: ForeignKey.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/ForeignKey.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ForeignKey.cs 9 Feb 2005 03:09:39 -0000 1.8 --- ForeignKey.cs 14 Mar 2005 14:36:26 -0000 1.9 *************** *** 23,30 **** /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="constraintName">The name to use as the identifier of the constraint in the database.</param> /// <returns> /// A string that contains the SQL to create the named Foreign Key Constraint. /// </returns> ! public override string SqlConstraintString( Dialect.Dialect d, string constraintName ) { string[ ] cols = new string[ColumnSpan]; --- 23,31 ---- /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="constraintName">The name to use as the identifier of the constraint in the database.</param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to create the named Foreign Key Constraint. /// </returns> ! public override string SqlConstraintString( Dialect.Dialect d, string constraintName, string defaultSchema ) { string[ ] cols = new string[ColumnSpan]; *************** *** 45,49 **** } ! return d.GetAddForeignKeyConstraintString( constraintName, cols, referencedTable.GetQualifiedName( d ), refcols ); } --- 46,50 ---- } ! return d.GetAddForeignKeyConstraintString( constraintName, cols, referencedTable.GetQualifiedName( d, defaultSchema ), refcols ); } *************** *** 96,105 **** /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> ! /// <returns> /// A string that contains the SQL to drop this Constraint. /// </returns> ! public override string SqlDropString(NHibernate.Dialect.Dialect dialect) { ! return "alter table " + Table.GetQualifiedName( dialect ) + dialect.GetDropForeignKeyConstraintString( Name ); } --- 97,108 ---- /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> ! /// <param name="defaultSchema"></param> ! /// <returns> /// A string that contains the SQL to drop this Constraint. /// </returns> ! public override string SqlDropString(NHibernate.Dialect.Dialect dialect, string defaultSchema ) { ! // TODO: NH 1.0+ Get this from the Dialect ! return string.Format( "alter table {0} {1}", Table.GetQualifiedName( dialect, defaultSchema ), dialect.GetDropForeignKeyConstraintString( Name ) ); } Index: List.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/List.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** List.cs 1 Mar 2005 16:24:49 -0000 1.9 --- List.cs 14 Mar 2005 14:36:26 -0000 1.10 *************** *** 21,31 **** get { return TypeFactory.List( Role ); } } - - /// <summary></summary> - public override System.Type WrapperClass - { - get { return typeof( NHibernate.Collection.List ); } - } - } } \ No newline at end of file --- 21,24 ---- Index: Bag.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Bag.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Bag.cs 1 Mar 2005 16:24:49 -0000 1.7 --- Bag.cs 14 Mar 2005 14:36:26 -0000 1.8 *************** *** 22,31 **** } - /// <summary></summary> - public override System.Type WrapperClass - { - get { return typeof( NHibernate.Collection.Bag ); } - } - /// <summary> /// --- 22,25 ---- Index: IdentifierBag.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/IdentifierBag.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** IdentifierBag.cs 1 Mar 2005 16:24:49 -0000 1.5 --- IdentifierBag.cs 14 Mar 2005 14:36:26 -0000 1.6 *************** *** 22,32 **** get { return TypeFactory.IdBag( Role ); } } - - /// <summary></summary> - public override System.Type WrapperClass - { - get { return typeof( NHibernate.Collection.IdentifierBag ); } - } - } } \ No newline at end of file --- 22,25 ---- Index: Table.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Table.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Table.cs 1 Mar 2005 16:24:49 -0000 1.16 --- Table.cs 14 Mar 2005 14:36:26 -0000 1.17 *************** *** 1,6 **** - using System; using System.Collections; using System.Data; using System.Text; using NHibernate.Engine; using NHibernate.Id; --- 1,6 ---- using System.Collections; using System.Data; using System.Text; + using NHibernate.Cfg; using NHibernate.Engine; using NHibernate.Id; *************** *** 258,269 **** /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="p"></param> /// <returns> /// A string that contains the SQL to create this Table, Primary Key Constraints /// , and Unique Key Constraints. /// </returns> ! public string SqlCreateString( Dialect.Dialect dialect, IMapping p ) { StringBuilder buf = new StringBuilder( "create table " ) ! .Append( GetQualifiedName( dialect ) ) .Append( " (" ); --- 258,270 ---- /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="p"></param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to create this Table, Primary Key Constraints /// , and Unique Key Constraints. /// </returns> ! public string SqlCreateString( Dialect.Dialect dialect, IMapping p, string defaultSchema ) { StringBuilder buf = new StringBuilder( "create table " ) ! .Append( GetQualifiedName( dialect, defaultSchema ) ) .Append( " (" ); *************** *** 330,334 **** // //ugly hack... //} else { ! buf.Append( ',' ).Append( primaryKey.SqlConstraintString( dialect ) ); //} } --- 331,335 ---- // //ugly hack... //} else { ! buf.Append( ',' ).Append( primaryKey.SqlConstraintString( dialect, defaultSchema ) ); //} } *************** *** 348,358 **** /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <returns> /// A string that contains the SQL to drop this Table and to cascade the drop to /// the constraints if the database supports it. /// </returns> ! public string SqlDropString( Dialect.Dialect dialect ) { ! return "drop table " + GetQualifiedName( dialect ) + dialect.CascadeConstraintsString; } --- 349,361 ---- /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to drop this Table and to cascade the drop to /// the constraints if the database supports it. /// </returns> ! public string SqlDropString( Dialect.Dialect dialect, string defaultSchema ) { ! // TODO: NH 1.0+ Get this from the dialect ! return "drop table " + GetQualifiedName( dialect, defaultSchema ) + dialect.CascadeConstraintsString; } *************** *** 416,420 **** --- 419,425 ---- /// Create a <see cref="ForeignKey"/> for the columns in the Table. /// </summary> + /// <param name="keyName"></param> /// <param name="columns">An <see cref="IList"/> of <see cref="Column"/> objects.</param> + /// <param name="referencedClass"></param> /// <returns> /// A <see cref="ForeignKey"/> for the columns in the Table. *************** *** 425,439 **** /// existing <see cref="ForeignKey"/>. /// </remarks> ! public ForeignKey CreateForeignKey( IList columns ) { ! string name = "FK" + UniqueColumnString( columns ); ! ForeignKey fk = ( ForeignKey ) foreignKeys[ name ]; if( fk == null ) { fk = new ForeignKey(); ! fk.Name = name; fk.Table = this; ! foreignKeys.Add( name, fk ); } --- 430,457 ---- /// existing <see cref="ForeignKey"/>. /// </remarks> ! public ForeignKey CreateForeignKey( string keyName, IList columns, System.Type referencedClass ) { ! if ( keyName == null ) ! { ! keyName = "FK" + UniqueColumnString( columns ); ! } ! ForeignKey fk = ( ForeignKey ) foreignKeys[ keyName ]; if( fk == null ) { fk = new ForeignKey(); ! fk.Name = keyName; fk.Table = this; ! fk.ReferencedClass = referencedClass; ! foreignKeys.Add( keyName, fk ); ! } ! else ! { ! // "X"= hexadecimal format ! keyName += referencedClass.Name.GetHashCode().ToString( "X" ).ToUpper(); ! if ( fk.ReferencedClass != referencedClass ) ! { ! fk = CreateForeignKey( keyName, columns, referencedClass ); ! } } |
From: Paul H. <pha...@us...> - 2005-03-14 14:36:05
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32554/nhibernate/src/NHibernate/Cfg Modified Files: Binder.cs Configuration.cs Log Message: Bringing mapping/config to 2.1 feature set - excludes metaData Index: Binder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Binder.cs,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** Binder.cs 6 Mar 2005 12:44:35 -0000 1.40 --- Binder.cs 14 Mar 2005 14:35:54 -0000 1.41 *************** *** 235,239 **** model.Identifier = id; ! if ( propertyName==null) { BindSimpleValue(subnode, id, false, RootClass.DefaultIdentifierColumnName, mappings); --- 235,239 ---- model.Identifier = id; ! if ( propertyName == null) { BindSimpleValue(subnode, id, false, RootClass.DefaultIdentifierColumnName, mappings); *************** *** 243,250 **** else { ! BindSimpleValue(subnode, id, false, propertyName, mappings); ! id.SetTypeByReflection( model.MappedClass, propertyName); ! Mapping.Property prop = new Mapping.Property(id); ! BindProperty(subnode, prop, mappings); model.IdentifierProperty = prop; } --- 243,250 ---- else { ! BindSimpleValue( subnode, id, false, propertyName, mappings ); ! id.SetTypeByReflection( model.MappedClass, propertyName, PropertyAccess( subnode, mappings ) ); ! Mapping.Property prop = new Mapping.Property( id ); ! BindProperty( subnode, prop, mappings ); model.IdentifierProperty = prop; } *************** *** 305,308 **** --- 305,312 ---- model.IsForceDiscriminator = true; } + if ( subnode.Attributes["insert"] != null && "true".Equals( subnode.Attributes["false"].Value ) ) + { + model.IsDiscriminatorInsertable = false; + } break; *************** *** 436,439 **** --- 440,449 ---- */ + private static string PropertyAccess( XmlNode node, Mappings mappings ) + { + XmlAttribute accessNode = node.Attributes["access"]; + return accessNode != null ? accessNode.Value : mappings.DefaultAccess; + } + /// <summary> /// *************** *** 448,460 **** if (type==null) throw new MappingException("could not determine a property type for: " + model.Name ); ! XmlAttribute accessNode = node.Attributes["access"]; ! if( accessNode!=null) ! { ! model.PropertyAccessorName = accessNode.Value; ! } ! else ! { ! model.PropertyAccessorName = mappings.DefaultAccess; ! } XmlAttribute cascadeNode = node.Attributes["cascade"]; model.Cascade = (cascadeNode==null) ? mappings.DefaultCascade : cascadeNode.Value; --- 458,463 ---- if (type==null) throw new MappingException("could not determine a property type for: " + model.Name ); ! model.PropertyAccessorName = PropertyAccess( node, mappings ); ! XmlAttribute cascadeNode = node.Attributes["cascade"]; model.Cascade = (cascadeNode==null) ? mappings.DefaultCascade : cascadeNode.Value; *************** *** 643,646 **** --- 646,655 ---- InitOuterJoinFetchSetting(node, model); + XmlAttribute ukName = node.Attributes["property-ref"]; + if ( ukName != null ) + { + model.ReferencedPropertyName = ukName.Value; + } + XmlAttribute typeNode = node.Attributes["class"]; *************** *** 649,653 **** try { ! model.Type = TypeFactory.ManyToOne( ReflectHelper.ClassForName( typeNode.Value ) ); } catch --- 658,662 ---- try { ! model.Type = TypeFactory.ManyToOne( ReflectHelper.ClassForName( typeNode.Value ), model.ReferencedPropertyName ); } catch *************** *** 656,659 **** --- 665,674 ---- } } + + XmlAttribute fkNode = node.Attributes["foreign-key"]; + if ( fkNode != null ) + { + model.ForeignKeyName = fkNode.Value; + } } *************** *** 668,671 **** --- 683,688 ---- if ( metaType==null ) throw new MappingException("could not interpret meta-type"); model.MetaType = metaType; + + // TODO: 2.1 Handle meta-value collection } *************** *** 684,693 **** model.ForeignKeyType = (constrained ? ForeignKeyType.ForeignKeyFromParent : ForeignKeyType.ForeignKeyToParent); ! XmlAttribute classNode = node.Attributes["class"]; ! if (classNode!=null) { try { ! model.Type = TypeFactory.OneToOne( ReflectHelper.ClassForName( classNode.Value ), model.ForeignKeyType); } catch (Exception) --- 701,722 ---- model.ForeignKeyType = (constrained ? ForeignKeyType.ForeignKeyFromParent : ForeignKeyType.ForeignKeyToParent); ! XmlAttribute fkNode = node.Attributes[ "foreign-key" ]; ! if ( fkNode != null ) ! { ! model.ForeignKeyName = fkNode.Value; ! } ! ! XmlAttribute ukName = node.Attributes[ "property-ref" ]; ! if ( ukName != null ) ! { ! model.ReferencedPropertyName = ukName.Value; ! } ! ! XmlAttribute classNode = node.Attributes[ "class" ]; ! if ( classNode != null ) { try { ! model.Type = TypeFactory.OneToOne( ReflectHelper.ClassForName( classNode.Value ), model.ForeignKeyType, model.ReferencedPropertyName ) ; } catch (Exception) *************** *** 721,724 **** --- 750,756 ---- XmlAttribute unqNode = node.Attributes["unique"]; model.IsUnique = unqNode!=null && StringHelper.BooleanValue( unqNode.Value ); + + XmlAttribute chkNode = node.Attributes["check"]; + model.CheckConstraint = chkNode != null ? chkNode.Value : string.Empty; XmlAttribute typeNode = node.Attributes["sql-type"]; *************** *** 920,924 **** if ( parentClass != null && value.IsSimpleValue ) { ! ( (SimpleValue) value).SetTypeByReflection( parentClass, propertyName ); } --- 952,956 ---- if ( parentClass != null && value.IsSimpleValue ) { ! ( (SimpleValue) value).SetTypeByReflection( parentClass, propertyName, PropertyAccess( subnode, mappings ) ); } *************** *** 936,940 **** Mapping.Property prop = new Mapping.Property(); prop.Value = value; ! BindProperty(subnode, prop, mappings); return prop; --- 968,972 ---- Mapping.Property prop = new Mapping.Property(); prop.Value = value; ! BindProperty( subnode, prop, mappings ); return prop; Index: Configuration.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Configuration.cs,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** Configuration.cs 6 Mar 2005 12:44:35 -0000 1.33 --- Configuration.cs 14 Mar 2005 14:35:54 -0000 1.34 *************** *** 560,564 **** foreach( ForeignKey fk in table.ForeignKeyCollection ) { ! script.Add( fk.SqlDropString( dialect ) ); } } --- 560,564 ---- foreach( ForeignKey fk in table.ForeignKeyCollection ) { ! script.Add( fk.SqlDropString( dialect, (string) properties[ Environment.DefaultSchema ] ) ); } } *************** *** 567,571 **** foreach( Table table in TableMappings ) { ! script.Add( table.SqlDropString( dialect ) ); } --- 567,571 ---- foreach( Table table in TableMappings ) { ! script.Add( table.SqlDropString( dialect, (string) properties[ Environment.DefaultSchema ] ) ); } *************** *** 594,598 **** foreach( Table table in TableMappings ) { ! script.Add( table.SqlCreateString( dialect, this ) ); } --- 594,598 ---- foreach( Table table in TableMappings ) { ! script.Add( table.SqlCreateString( dialect, this, (string) properties[ Environment.DefaultSchema ] ) ); } *************** *** 601,605 **** foreach( Index index in table.IndexCollection ) { ! script.Add( index.SqlCreateString( dialect, this ) ); } if( dialect.HasAlterTable ) --- 601,605 ---- foreach( Index index in table.IndexCollection ) { ! script.Add( index.SqlCreateString( dialect, this, (string) properties[ Environment.DefaultSchema ] ) ); } if( dialect.HasAlterTable ) *************** *** 607,611 **** foreach( ForeignKey fk in table.ForeignKeyCollection ) { ! script.Add( fk.SqlCreateString( dialect, this ) ); } } --- 607,611 ---- foreach( ForeignKey fk in table.ForeignKeyCollection ) { ! script.Add( fk.SqlCreateString( dialect, this, (string) properties[ Environment.DefaultSchema ] ) ); } } |
From: Paul H. <pha...@us...> - 2005-03-14 14:33:29
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31801/nhibernate/src/NHibernate/Dialect Modified Files: Dialect.cs MsSql2000Dialect.cs MsSql7Dialect.cs MySQLDialect.cs Log Message: Expose Open/CloseQuote so we can decouple Aliasing from needing a Dialect object Index: MsSql2000Dialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** MsSql2000Dialect.cs 6 Mar 2005 12:44:37 -0000 1.26 --- MsSql2000Dialect.cs 14 Mar 2005 14:33:16 -0000 1.27 *************** *** 245,249 **** /// <summary></summary> ! protected override char CloseQuote { get { return ']'; } --- 245,249 ---- /// <summary></summary> ! public override char CloseQuote { get { return ']'; } *************** *** 251,255 **** /// <summary></summary> ! protected override char OpenQuote { get { return '['; } --- 251,255 ---- /// <summary></summary> ! public override char OpenQuote { get { return '['; } Index: Dialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/Dialect.cs,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** Dialect.cs 1 Mar 2005 16:24:44 -0000 1.45 --- Dialect.cs 14 Mar 2005 14:33:16 -0000 1.46 *************** *** 551,555 **** /// The opening quote for a quoted identifier. /// </summary> ! protected virtual char OpenQuote { get { return '"'; } --- 551,555 ---- /// The opening quote for a quoted identifier. /// </summary> ! public virtual char OpenQuote { get { return '"'; } *************** *** 559,563 **** /// The closing quote for a quoted identifier. /// </summary> ! protected virtual char CloseQuote { get { return '"'; } --- 559,563 ---- /// The closing quote for a quoted identifier. /// </summary> ! public virtual char CloseQuote { get { return '"'; } Index: MsSql7Dialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/MsSql7Dialect.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MsSql7Dialect.cs 31 Dec 2004 17:07:24 -0000 1.2 --- MsSql7Dialect.cs 14 Mar 2005 14:33:16 -0000 1.3 *************** *** 18,22 **** /// There is a well known problem with @@identity and triggers that insert into /// rows into other tables that also use an identity column. The only way I know ! /// of to get around this problem is to upgrade your databse server to Ms Sql 2000. /// </remarks> public override string IdentitySelectString --- 18,22 ---- /// There is a well known problem with @@identity and triggers that insert into /// rows into other tables that also use an identity column. The only way I know ! /// of to get around this problem is to upgrade your database server to Ms Sql 2000. /// </remarks> public override string IdentitySelectString Index: MySQLDialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/MySQLDialect.cs,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** MySQLDialect.cs 6 Mar 2005 12:44:37 -0000 1.28 --- MySQLDialect.cs 14 Mar 2005 14:33:16 -0000 1.29 *************** *** 104,108 **** /// <summary></summary> ! protected override char CloseQuote { get { return '`'; } --- 104,108 ---- /// <summary></summary> ! public override char CloseQuote { get { return '`'; } *************** *** 110,114 **** /// <summary></summary> ! protected override char OpenQuote { get { return '`'; } --- 110,114 ---- /// <summary></summary> ! public override char OpenQuote { get { return '`'; } |
From: Paul H. <pha...@us...> - 2005-03-14 14:07:42
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Transform In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24803/Transform Log Message: Directory /cvsroot/nhibernate/nhibernate/src/NHibernate/Transform added to the repository |
From: Paul H. <pha...@us...> - 2005-03-10 02:21:17
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31152/nhibernate/src/NHibernate/Impl Modified Files: SessionImpl.cs Log Message: Refactored object delete as per 2.1 Index: SessionImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionImpl.cs,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** SessionImpl.cs 6 Mar 2005 12:44:42 -0000 1.69 --- SessionImpl.cs 10 Mar 2005 02:21:06 -0000 1.70 *************** *** 1373,1384 **** } ! if( !persister.IsMutable ) ! { ! throw new HibernateException( ! "attempted to delete an object of immutable class: " + ! MessageHelper.InfoString( persister ) ! ); ! } if( log.IsDebugEnabled ) { --- 1373,1381 ---- } ! DoDelete( obj, entry, persister ); ! } + private void DoDelete( object obj, EntityEntry entry, IClassPersister persister ) + { if( log.IsDebugEnabled ) { *************** *** 1390,1501 **** object version = entry.Version; if( entry.LoadedState == null ) { //ie the object came in from Update() ! entry.DeletedState = persister.GetPropertyValues( obj ); } else { ! entry.DeletedState = new object[entry.LoadedState.Length]; ! TypeFactory.DeepCopy( entry.LoadedState, propTypes, persister.PropertyUpdateability, entry.DeletedState ); } interceptor.OnDelete( obj, entry.Id, entry.DeletedState, persister.PropertyNames, propTypes ); ! NullifyTransientReferences( entry.DeletedState, propTypes, false, obj ); ! ISet oldNullifiables = null; ! ArrayList oldDeletions = null; ! if( persister.HasCascades ) { ! oldNullifiables = new HashedSet(); ! oldNullifiables.AddAll( nullifiables ); ! oldDeletions = ( ArrayList ) deletions.Clone(); ! } ! nullifiables.Add( new Key( entry.Id, persister ) ); ! entry.Status = Status.Deleted; // before any callbacks, etc, so subdeletions see that this deletion happend first ! ScheduledDeletion delete = new ScheduledDeletion( entry.Id, version, obj, persister, this ); ! deletions.Add( delete ); // ensures that containing deletions happen before sub-deletions ! try ! { ! // after nullify, because we don't want to nullify references to subdeletions ! // try to do callback + cascade ! if( persister.ImplementsLifecycle ) { ! if( ( ( ILifecycle ) obj ).OnDelete( this ) == LifecycleVeto.Veto ) { //rollback deletion ! RollbackDeletion( entry, delete ); ! return; //don't let it cascade } } ! ! //BEGIN YUCKINESS: ! if( persister.HasCascades ) { ! int start = deletions.Count; ! ! ISet newNullifiables = nullifiables; nullifiables = oldNullifiables; ! cascading++; ! try ! { ! // cascade-delete to collections "BEFORE" the collection owner is deleted ! Cascades.Cascade( this, persister, obj, Cascades.CascadingAction.ActionDelete, CascadePoint.CascadeAfterInsertBeforeDelete, null ); ! } ! finally ! { ! cascading--; ! newNullifiables.AddAll( oldNullifiables ); ! nullifiables = newNullifiables; ! } ! ! int end = deletions.Count; ! ! if( end != start ) ! { ! //ie if any deletions occurred as a result of cascade ! ! //move them earlier. this is yucky code: ! // in h203 they used SubList where it takes the start and end indexes, in nh GetRange ! // takes the start index and quantity to get. ! IList middle = deletions.GetRange( oldDeletions.Count, ( start - oldDeletions.Count ) ); ! IList tail = deletions.GetRange( start, ( end - start ) ); ! oldDeletions.AddRange( tail ); ! oldDeletions.AddRange( middle ); ! if( oldDeletions.Count != end ) ! { ! throw new AssertionFailure( "Bug cascading collection deletions" ); ! } ! deletions = oldDeletions; ! } ! } ! //END YUCKINESS ! // cascade-save to many-to-one AFTER the parent was saved Cascades.Cascade( this, persister, obj, Cascades.CascadingAction.ActionDelete, CascadePoint.CascadeBeforeInsertAfterDelete, null ); } ! catch( Exception e ) { ! //mainly a CallbackException ! RollbackDeletion( entry, delete ); ! if( e is HibernateException ) ! { ! throw; ! } ! else ! { ! log.Error( "unexpected exception", e ); ! throw new HibernateException( "unexpected exception", e ); ! } } } --- 1387,1501 ---- object version = entry.Version; + object[] loadedState; if( entry.LoadedState == null ) { //ie the object came in from Update() ! loadedState = persister.GetPropertyValues( obj ); } else { ! loadedState = entry.LoadedState; } + entry.DeletedState = new object[ loadedState.Length ]; + TypeFactory.DeepCopy( loadedState, propTypes, persister.PropertyUpdateability, entry.DeletedState ); interceptor.OnDelete( obj, entry.Id, entry.DeletedState, persister.PropertyNames, propTypes ); ! entry.Status = Status.Deleted; // before cascade and Lifecycle callback, so we are circular-reference safe ! Key key = new Key( entry.Id, persister ); ! IList deletionsByOnDelete = null; ! ISet nullifiablesAfterOnDelete = null; ! ! // do Lifecycle callback before cascades, since this can veto ! if ( persister.ImplementsLifecycle ) { ! ISet oldNullifiables = (ISet) nullifiables.Clone(); ! ArrayList oldDeletions = (ArrayList) deletions.Clone(); ! nullifiables.Add( key ); //the deletion of the parent is actually executed BEFORE any deletion from onDelete() ! try { ! log.Debug( "calling onDelete()" ); ! if ( ( (ILifecycle) obj).OnDelete( this ) == LifecycleVeto.Veto ) { //rollback deletion ! entry.Status = Status.Loaded; ! entry.DeletedState = null; ! nullifiables = oldNullifiables; ! log.Debug( "deletion vetoed by onDelete()" ); ! return; // don't let it cascade } } ! catch ( Exception ) { ! //rollback deletion ! entry.Status = Status.Loaded; ! entry.DeletedState = null; nullifiables = oldNullifiables; + throw; + } ! //note, the following assumes that onDelete() didn't cause the session to be flushed! ! // TODO: add a better check that it doesn't ! if ( oldDeletions.Count > deletions.Count ) ! { ! throw new HibernateException( "session was flushed during onDelete()" ); ! } ! deletionsByOnDelete = Sublist( deletions, oldDeletions.Count, deletions.Count ); ! deletions = oldDeletions; ! nullifiablesAfterOnDelete = nullifiables; ! nullifiables = oldNullifiables; ! } ! cascading++; ! try ! { ! // cascade-delete to collections "BEFORE" the collection owner is deleted ! Cascades.Cascade( this, persister, obj, Cascades.CascadingAction.ActionDelete, CascadePoint.CascadeAfterInsertBeforeDelete, null ); ! } ! finally ! { ! cascading--; ! } ! NullifyTransientReferences( entry.DeletedState, propTypes, false, obj ); ! CheckNullability( entry.DeletedState, persister, true ); ! nullifiables.Add( key ); ! ScheduledDeletion delete = new ScheduledDeletion( entry.Id, version, obj, persister, this ); ! deletions.Add( delete ); // Ensures that containing deletions happen before sub-deletions ! if ( persister.ImplementsLifecycle ) ! { ! // after nullify, because we don't want to nullify references to subdeletions ! nullifiables.AddAll( nullifiablesAfterOnDelete ); ! // after deletions.add(), to respect foreign key constraints ! deletions.AddRange( deletionsByOnDelete ); ! } ! cascading++; ! try ! { ! // cascade-delete to many-to-one AFTER the parent was deleted Cascades.Cascade( this, persister, obj, Cascades.CascadingAction.ActionDelete, CascadePoint.CascadeBeforeInsertAfterDelete, null ); } ! finally { ! cascading--; ! } ! } ! ! private IList Sublist( IList list, int fromIx, int toIx ) ! { ! IList newList = new ArrayList( toIx - fromIx ); + for ( int i = fromIx; i < toIx; i++ ) + { + newList.Add( list[ i ] ); } + + return newList; } |
From: Paul H. <pha...@us...> - 2005-03-08 17:09:49
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27538/nhibernate/src/NHibernate/Cfg Modified Files: Settings.cs Log Message: Comment out unused 2.1 variabled to clean up build Index: Settings.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Settings.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Settings.cs 6 Mar 2005 12:44:36 -0000 1.5 --- Settings.cs 8 Mar 2005 17:09:38 -0000 1.6 *************** *** 27,31 **** private bool autoCreateSchema; private bool autoDropSchema; ! private bool autoUpdateSchema; private ICacheProvider _cacheProvider; private string _defaultSchemaName; --- 27,31 ---- private bool autoCreateSchema; private bool autoDropSchema; ! //private bool autoUpdateSchema; private ICacheProvider _cacheProvider; private string _defaultSchemaName; |
From: Paul H. <pha...@us...> - 2005-03-08 16:49:49
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22672/nhibernate/src/NHibernate/Mapping Modified Files: PersistentClass.cs Property.cs Log Message: Comment out unused 2.1 variables to clean the build slightly Index: PersistentClass.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/PersistentClass.cs,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** PersistentClass.cs 6 Mar 2005 12:44:44 -0000 1.20 --- PersistentClass.cs 8 Mar 2005 16:49:23 -0000 1.21 *************** *** 35,39 **** private bool selectBeforeUpdate; private int optimisticLockMode; ! private IDictionary metaAttributes; /// <summary> --- 35,39 ---- private bool selectBeforeUpdate; private int optimisticLockMode; ! //private IDictionary metaAttributes; /// <summary> Index: Property.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Property.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Property.cs 1 Mar 2005 16:24:49 -0000 1.11 --- Property.cs 8 Mar 2005 16:49:24 -0000 1.12 *************** *** 15,19 **** private bool insertable = true; private string propertyAccessorName; ! private IDictionary metaAttributes; /// <summary> --- 15,19 ---- private bool insertable = true; private string propertyAccessorName; ! //private IDictionary metaAttributes; /// <summary> |
From: Paul H. <pha...@us...> - 2005-03-08 16:48:26
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22295/nhibernate/src/NHibernate/Type Modified Files: ManyToOneType.cs Log Message: Changed as per 2.1 implementation Index: ManyToOneType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/ManyToOneType.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ManyToOneType.cs 1 Mar 2005 16:24:50 -0000 1.10 --- ManyToOneType.cs 8 Mar 2005 16:48:16 -0000 1.11 *************** *** 48,52 **** public override void NullSafeSet( IDbCommand cmd, object value, int index, ISessionImplementor session ) { ! session.Factory.GetIdentifierType( AssociatedClass ) .NullSafeSet( cmd, GetIdentifier( value, session ), index, session ); } --- 48,52 ---- public override void NullSafeSet( IDbCommand cmd, object value, int index, ISessionImplementor session ) { ! GetIdentifierOrUniqueKeyType( session.Factory ) .NullSafeSet( cmd, GetIdentifier( value, session ), index, session ); } *************** *** 82,87 **** public override object Hydrate( IDataReader rs, string[ ] names, ISessionImplementor session, object owner ) { ! return session.Factory.GetIdentifierType( AssociatedClass ) .NullSafeGet( rs, names, session, owner ); } --- 82,93 ---- public override object Hydrate( IDataReader rs, string[ ] names, ISessionImplementor session, object owner ) { ! object id = GetIdentifierOrUniqueKeyType( session.Factory ) .NullSafeGet( rs, names, session, owner ); + + if ( id != null ) + { + session.ScheduleBatchLoad( AssociatedClass, id ); + } + return id; } |
From: Paul H. <pha...@us...> - 2005-03-08 16:26:25
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16302/nhibernate/src/NHibernate/Collection Modified Files: AbstractCollectionPersister.cs BasicCollectionPersister.cs OneToManyPersister.cs Log Message: Bug fixing collection persister - aiming at 2.1 Loader features Index: OneToManyPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/OneToManyPersister.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OneToManyPersister.cs 1 Mar 2005 16:24:44 -0000 1.1 --- OneToManyPersister.cs 8 Mar 2005 16:26:12 -0000 1.2 *************** *** 39,44 **** protected override SqlString GenerateDeleteString( ) { ! SqlUpdateBuilder update = new SqlUpdateBuilder( factory ); ! update.SetTableName( QualifiedTableName ) .AddColumns( KeyColumnNames, "null" ) .SetIdentityColumn( KeyColumnNames, KeyType ); --- 39,44 ---- protected override SqlString GenerateDeleteString( ) { ! SqlUpdateBuilder update = new SqlUpdateBuilder( factory ) ! .SetTableName( QualifiedTableName ) .AddColumns( KeyColumnNames, "null" ) .SetIdentityColumn( KeyColumnNames, KeyType ); *************** *** 236,240 **** { // Super impl will ignore suffix for collection columns! ! return SelectFragment( alias ).Append( StringHelper.CommaSpace ); } else --- 236,241 ---- { // Super impl will ignore suffix for collection columns! ! //return SelectFragment( alias ).Append( StringHelper.CommaSpace ); ! return SelectFragment( alias ); } else *************** *** 252,259 **** protected override ICollectionInitializer CreateCollectionInitializer( ISessionFactoryImplementor factory ) { ! // Don't worry about batching for now ! // TODO: Uncomment when we implement OneToManyLoader /* - Loader nonbatchLoader = new OneToManyLoader( this, factory ); if ( batchSize > 1 ) { --- 253,259 ---- protected override ICollectionInitializer CreateCollectionInitializer( ISessionFactoryImplementor factory ) { ! Loader.Loader nonbatchLoader = new OneToManyLoader( this, factory ); ! /* if ( batchSize > 1 ) { *************** *** 271,275 **** */ ! return null; } --- 271,276 ---- */ ! // Don't worry about batching for now ! return nonbatchLoader as ICollectionInitializer; } Index: BasicCollectionPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/BasicCollectionPersister.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BasicCollectionPersister.cs 1 Mar 2005 16:24:44 -0000 1.1 --- BasicCollectionPersister.cs 8 Mar 2005 16:26:12 -0000 1.2 *************** *** 34,65 **** /// <summary> ! /// /// </summary> /// <returns></returns> protected override SqlString GenerateDeleteString( ) { ! SqlDeleteBuilder delete = new SqlDeleteBuilder( factory ); ! delete.SetTableName( QualifiedTableName ); ! if( HasIdentifier ) ! { ! delete.AddWhereFragment( RowSelectColumnNames, RowSelectType, " = " ); ! } ! else { ! delete.AddWhereFragment( KeyColumnNames, KeyType, " = " ) ! .AddWhereFragment( RowSelectColumnNames, RowSelectType, " = " ); } - return delete.ToSqlString(); } /// <summary> ! /// /// </summary> /// <returns></returns> protected override SqlString GenerateInsertRowString( ) { ! SqlInsertBuilder insert = new SqlInsertBuilder( factory ); ! insert.SetTableName( QualifiedTableName ) .AddColumn( KeyColumnNames, KeyType ); if( HasIndex ) --- 34,60 ---- /// <summary> ! /// Generate the SQL DELETE that deletes all rows /// </summary> /// <returns></returns> protected override SqlString GenerateDeleteString( ) { ! SqlDeleteBuilder delete = new SqlDeleteBuilder( factory ) ! .SetTableName( QualifiedTableName ) ! .SetIdentityColumn( KeyColumnNames, KeyType ); ! if( HasWhere ) { ! delete.AddWhereFragment( Where ); } return delete.ToSqlString(); } /// <summary> ! /// Generate the SQL INSERT that creates a new row /// </summary> /// <returns></returns> protected override SqlString GenerateInsertRowString( ) { ! SqlInsertBuilder insert = new SqlInsertBuilder( factory ) ! .SetTableName( QualifiedTableName ) .AddColumn( KeyColumnNames, KeyType ); if( HasIndex ) *************** *** 77,87 **** /// <summary> ! /// /// </summary> /// <returns></returns> protected override SqlString GenerateUpdateRowString( ) { ! SqlUpdateBuilder update = new SqlUpdateBuilder( factory ); ! update.SetTableName( QualifiedTableName ) .AddColumns( ElementColumnNames, ElementType ); if( HasIdentifier ) --- 72,82 ---- /// <summary> ! /// Generate the SQL UPDATE that updates a row /// </summary> /// <returns></returns> protected override SqlString GenerateUpdateRowString( ) { ! SqlUpdateBuilder update = new SqlUpdateBuilder( factory ) ! .SetTableName( QualifiedTableName ) .AddColumns( ElementColumnNames, ElementType ); if( HasIdentifier ) *************** *** 99,103 **** /// <summary> ! /// /// </summary> /// <returns></returns> --- 94,98 ---- /// <summary> ! /// Generate the SQL DELETE that deletes a particular row /// </summary> /// <returns></returns> *************** *** 204,210 **** { // Don't worry about batching for now ! // TODO: Uncomment when we implement CollectionLoader ! //return (ICollectionInitializer) new CollectionLoader( this, factory ); ! return null; } --- 199,203 ---- { // Don't worry about batching for now ! return new CollectionLoader( this, factory ) as ICollectionInitializer; } *************** *** 242,246 **** public override SqlString SelectFragment( string alias, string suffix, bool includeCollectionColumns ) { ! return includeCollectionColumns ? SelectFragment( alias ) : null; } } --- 235,240 ---- public override SqlString SelectFragment( string alias, string suffix, bool includeCollectionColumns ) { ! // TODO: Changed from Null to SqlString( string.Empty ) as per Java ! return includeCollectionColumns ? SelectFragment( alias ) : new SqlString( string.Empty ) ; } } Index: AbstractCollectionPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/AbstractCollectionPersister.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractCollectionPersister.cs 1 Mar 2005 16:24:44 -0000 1.1 --- AbstractCollectionPersister.cs 8 Mar 2005 16:26:12 -0000 1.2 *************** *** 111,117 **** keyType = collection.Key.Type; ! int span = collection.Key.ColumnSpan; ! keyColumnNames = new string[span]; ! string[ ] keyAliases = new string[span]; int k = 0; foreach( Column col in collection.Key.ColumnCollection ) --- 111,117 ---- keyType = collection.Key.Type; ! int keySpan = collection.Key.ColumnSpan; ! keyColumnNames = new string[ keySpan ]; ! string[ ] keyAliases = new string[ keySpan ]; int k = 0; foreach( Column col in collection.Key.ColumnCollection ) *************** *** 153,158 **** qualifiedTableName = table.GetQualifiedName( dialect, factory.DefaultSchema ); ! string[ ] aliases = new string[span]; ! elementColumnNames = new string[span]; int j = 0; foreach( Column col in iter ) --- 153,158 ---- qualifiedTableName = table.GetQualifiedName( dialect, factory.DefaultSchema ); ! string[ ] aliases = new string[ elementSpan ]; ! elementColumnNames = new string[ elementSpan ]; int j = 0; foreach( Column col in iter ) *************** *** 1240,1250 **** try { ! initializer.Initialize( key, null, owner, session ); } ! catch ( Exception ) { // TODO: Improve the exception info, original java shown below // throw convert( sqle, "could not initialize collection: " + MessageHelper.infoString(this, key) ); ! throw new ArgumentException( "could not initialize collection: " ); } } --- 1240,1250 ---- try { ! initializer.Initialize( key, session ); } ! catch ( Exception e ) { // TODO: Improve the exception info, original java shown below // throw convert( sqle, "could not initialize collection: " + MessageHelper.infoString(this, key) ); ! throw new Exception( "could not initialize collection: ", e ); } } |
From: Michael D. <mik...@us...> - 2005-03-08 14:43:52
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHSpecificTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20884 Modified Files: GetTest.cs Log Message: added test to verify call to Get() adds the entity to the session so it can be processed during a flush. Index: GetTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHSpecificTest/GetTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GetTest.cs 11 Feb 2005 21:26:45 -0000 1.1 --- GetTest.cs 8 Mar 2005 14:43:41 -0000 1.2 *************** *** 46,49 **** --- 46,69 ---- } } + + [Test] + public void GetAndModify() + { + A a = new A( "name" ); + ISession s = sessions.OpenSession(); + s.Save( a ); + s.Close(); + + s = sessions.OpenSession(); + a = s.Get( typeof(A), a.Id ) as A; + a.Name = "modified"; + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + a = s.Get( typeof(A), a.Id ) as A; + Assert.AreEqual( "modified", a.Name, "the name was modified" ); + s.Close(); + } } } |
From: Paul H. <pha...@us...> - 2005-03-06 12:45:35
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21577/nhibernate/src/NHibernate/Cfg Modified Files: Binder.cs Configuration.cs Environment.cs Settings.cs SettingsFactory.cs Log Message: Refactored SessionImpl as per 2.1 for Save/Update Index: Environment.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Environment.cs,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Environment.cs 23 Jan 2005 15:41:39 -0000 1.23 --- Environment.cs 6 Mar 2005 12:44:36 -0000 1.24 *************** *** 26,32 **** public sealed class Environment { ! private static readonly ILog log = LogManager.GetLogger( typeof( Environment ) ); ! ! private static IDictionary properties = new Hashtable(); /// <summary></summary> --- 26,31 ---- public sealed class Environment { ! /// <summary></summary> ! public const string Version = "0.8.0.0"; /// <summary></summary> *************** *** 47,51 **** public const string ShowSql = "hibernate.show_sql"; /// <summary></summary> ! public const string OuterJoin = "hibernate.use_outer_join"; /// <summary></summary> public const string OutputStylesheet = "hibernate.xml.output_stylesheet"; --- 46,60 ---- public const string ShowSql = "hibernate.show_sql"; /// <summary></summary> ! public const string UseOuterJoin = "hibernate.use_outer_join"; ! /// <summary></summary> ! public const string MaxFetchDepth = "hibernate.max_fetch_depth"; ! /// <summary></summary> ! public const string UseGetGeneratedKeys = "hibernate.jdbc.use_get_generated_keys"; ! /// <summary></summary> ! public const string StatementFetchSize = "hibernate.jdbc.fetch_size"; ! /// <summary></summary> ! public const string StatementBatchSize = "hibernate.jdbc.batch_size"; ! /// <summary></summary> ! public const string BatchVersionedData = "hibernate.jdbc.batch_versioned_data"; /// <summary></summary> public const string OutputStylesheet = "hibernate.xml.output_stylesheet"; *************** *** 63,66 **** --- 72,79 ---- public const string PrepareSql = "hibernate.prepare_sql"; + private static readonly ILog log = LogManager.GetLogger( typeof( Environment ) ); + + private static IDictionary properties = new Hashtable(); + /// <summary></summary> static Environment() *************** *** 79,84 **** properties[ key ] = props[ key ]; } - - } --- 92,95 ---- *************** *** 112,115 **** --- 123,136 ---- get { return true; } } + + /// <summary> + /// Issue warnings to user when any obsolete property names are used. + /// </summary> + /// <param name="props"></param> + /// <returns></returns> + public static bool VerifyProperties( IDictionary props ) + { + return false; + } } } \ No newline at end of file Index: Binder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Binder.cs,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Binder.cs 1 Mar 2005 16:24:43 -0000 1.39 --- Binder.cs 6 Mar 2005 12:44:35 -0000 1.40 *************** *** 1269,1273 **** } ! public static void BindRoot(XmlDocument doc, Mappings model) { XmlNode hmNode = doc.DocumentElement; --- 1269,1273 ---- } ! public static void BindRoot( XmlDocument doc, Mappings model ) { XmlNode hmNode = doc.DocumentElement; *************** *** 1286,1305 **** // build the XPath and the nsmgr takes care of translating our prefix into // the user defined prefix... ! nsmgr.AddNamespace(nsPrefix, Configuration.MappingSchemaXMLNS); ! foreach(XmlNode n in hmNode.SelectNodes(nsPrefix + ":class", nsmgr) ) { RootClass rootclass = new RootClass(); ! Binder.BindRootClass(n, rootclass, model); ! model.AddClass(rootclass); } ! foreach(XmlNode n in hmNode.SelectNodes(nsPrefix + ":subclass", nsmgr) ) { ! PersistentClass superModel = GetSuperclass(model, n); HandleSubclass(superModel, model, n); } ! foreach(XmlNode n in hmNode.SelectNodes(nsPrefix + ":joined-subclass", nsmgr) ) { PersistentClass superModel = GetSuperclass(model, n); --- 1286,1305 ---- // build the XPath and the nsmgr takes care of translating our prefix into // the user defined prefix... ! nsmgr.AddNamespace( nsPrefix, Configuration.MappingSchemaXMLNS ); ! foreach(XmlNode n in hmNode.SelectNodes( nsPrefix + ":class", nsmgr ) ) { RootClass rootclass = new RootClass(); ! Binder.BindRootClass( n, rootclass, model ); ! model.AddClass( rootclass ); } ! foreach(XmlNode n in hmNode.SelectNodes( nsPrefix + ":subclass", nsmgr ) ) { ! PersistentClass superModel = GetSuperclass( model, n ); HandleSubclass(superModel, model, n); } ! foreach(XmlNode n in hmNode.SelectNodes( nsPrefix + ":joined-subclass", nsmgr ) ) { PersistentClass superModel = GetSuperclass(model, n); *************** *** 1307,1311 **** } ! foreach(XmlNode n in hmNode.SelectNodes(nsPrefix + ":query", nsmgr) ) { string qname = n.Attributes["name"].Value; --- 1307,1311 ---- } ! foreach(XmlNode n in hmNode.SelectNodes( nsPrefix + ":query", nsmgr ) ) { string qname = n.Attributes["name"].Value; *************** *** 1315,1331 **** } ! foreach(XmlNode n in hmNode.SelectNodes(nsPrefix + ":sql-query", nsmgr) ) { string qname = n.Attributes["name"].Value; NamedSQLQuery namedQuery = new NamedSQLQuery( n.FirstChild.Value ); ! foreach(XmlNode returns in n.SelectNodes(nsPrefix + ":return", nsmgr) ) { string alias = returns.Attributes["alias"].Value; ! object clazz; try { ! //clazz = ReflectorHelper.ClassForName( returns.Attributes["class"] ); ! clazz = null; } catch (Exception) --- 1315,1330 ---- } ! foreach(XmlNode n in hmNode.SelectNodes( nsPrefix + ":sql-query", nsmgr ) ) { string qname = n.Attributes["name"].Value; NamedSQLQuery namedQuery = new NamedSQLQuery( n.FirstChild.Value ); ! foreach(XmlNode returns in n.SelectNodes( nsPrefix + ":return", nsmgr ) ) { string alias = returns.Attributes["alias"].Value; ! System.Type clazz; try { ! clazz = ReflectHelper.ClassForName( returns.Attributes["class"].Value ); } catch (Exception) *************** *** 1336,1339 **** --- 1335,1343 ---- } + foreach( XmlNode table in n.SelectNodes( nsPrefix + ":synchronise", nsmgr ) ) + { + namedQuery.AddSynchronizedTable( table.Attributes["table"].Value ); + } + log.Debug("Named sql query: " + qname + " -> " + namedQuery.QueryString ); model.AddSQLQuery(qname, namedQuery); Index: Configuration.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Configuration.cs,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Configuration.cs 1 Mar 2005 16:24:43 -0000 1.32 --- Configuration.cs 6 Mar 2005 12:44:35 -0000 1.33 *************** *** 6,9 **** --- 6,10 ---- using System.Xml.Schema; using log4net; + using Iesi.Collections; using NHibernate.Cache; using NHibernate.Engine; *************** *** 31,37 **** public class Configuration : IMapping { - private static readonly ILog log = LogManager.GetLogger( typeof( Configuration ) ); - private static readonly IInterceptor emptyInterceptor = new EmptyInterceptor(); - private Hashtable classes = new Hashtable(); private Hashtable imports = new Hashtable(); --- 32,35 ---- *************** *** 51,54 **** --- 49,91 ---- private XmlSchema cfgSchema; + private static readonly ILog log = LogManager.GetLogger( typeof( Configuration ) ); + private static readonly IInterceptor emptyInterceptor = new EmptyInterceptor(); + + private class Mapping : IMapping + { + private Hashtable classes; + + public Mapping( Hashtable classes ) + { + this.classes = classes; + } + + public Hashtable Classes + { + set { classes = value; } + } + + #region IMapping Members + + public IType GetIdentifierType( System.Type persistentClass ) + { + return ( (PersistentClass) classes[ persistentClass ] ).Identifier.Type; + } + + public string GetIdentifierPropertyName( System.Type persistentClass ) + { + return ( (PersistentClass) classes[ persistentClass ] ).IdentifierProperty.Name; + } + + public IType GetPropertyType( System.Type persistentClass, string propertyName ) + { + return ( (PersistentClass) classes[ persistentClass ] ).GetProperty( propertyName ).Type; + } + + #endregion + } + + private Mapping mapping; + /// <summary> /// The XML Namespace for the nhibernate-mapping *************** *** 78,81 **** --- 115,119 ---- interceptor = emptyInterceptor; properties = Environment.Properties; + mapping = new Mapping( classes ); } *************** *** 135,141 **** /// <param name="role">role a collection role</param> /// <returns>collection</returns> ! public Mapping.Collection GetCollectionMapping( string role ) { ! return ( Mapping.Collection ) collections[ role ]; } --- 173,179 ---- /// <param name="role">role a collection role</param> /// <returns>collection</returns> ! public NHibernate.Mapping.Collection GetCollectionMapping( string role ) { ! return ( NHibernate.Mapping.Collection ) collections[ role ]; } *************** *** 561,564 **** --- 599,606 ---- foreach( Table table in TableMappings ) { + foreach( Index index in table.IndexCollection ) + { + script.Add( index.SqlCreateString( dialect, this ) ); + } if( dialect.HasAlterTable ) { *************** *** 568,575 **** } } - foreach( Index index in table.IndexCollection ) - { - script.Add( index.SqlCreateString( dialect, this ) ); - } } --- 610,613 ---- *************** *** 586,646 **** } ! // ///<summary> ! // /// Generate DDL for altering tables ! // ///</summary> ! // public string[] GenerateSchemaUpdateScript(Dialect.Dialect dialect, DatabaseMetadata databaseMetadata) ! // { ! // secondPassCompile(); ! // ! // ArrayList script = new ArrayList(50); ! // ! // foreach(Table table in TableMappings) ! // { ! // TableMetadata tableInfo = databaseMetadata.getTableMetadata( table.Name ); ! // if (tableInfo==null) ! // { ! // script.Add( table.SqlCreateString(dialect, this) ); ! // } ! // else ! // { ! // foreach(string alterString in table.SqlAlterStrings(dialect, this, tableInfo)) ! // script.Add(alterString); ! // } ! // } ! // ! // foreach(Table table in TableMappings) ! // { ! // TableMetadata tableInfo = databaseMetadata.getTableMetadata( table.Name ); ! // ! // if ( dialect.HasAlterTable) ! // { ! // foreach(ForeignKey fk in table.ForeignKeyCollection) ! // if ( tableInfo==null || tableInfo.getForeignKeyMetadata( fk.Name ) == null ) ! // { ! // script.Add( fk.SqlCreateString(dialect, mapping) ); ! // } ! // } ! // foreach(Index index in table.IndexCollection) ! // { ! // if ( tableInfo==null || tableInfo.getIndexMetadata( index.Name ) == null ) ! // { ! // script.Add( index.SqlCreateString(dialect, mapping) ); ! // } ! // } ! // } ! // ! // foreach(IPersistentIdentifierGenerator generator in CollectionGenerators(dialect)) ! // { ! // object key = generator.GeneratorKey(); ! // if ( !databaseMetadata.IsSequence(key) && !databaseMetadata.IsTable(key) ) ! // { ! // string[] lines = generator.SqlCreateStrings(dialect); ! // for (int i = 0; i < lines.Length; i++) script.Add( lines[i] ); ! // } ! // } ! // ! // return ArrayHelper.ToStringArray(script); ! // } ! //TODO: H2.0.3 After DatabaseMetadata is completed /// <remarks> --- 624,704 ---- } ! /* ! ///<summary> ! /// Generate DDL for altering tables ! ///</summary> ! public string[] GenerateSchemaUpdateScript(Dialect.Dialect dialect, DatabaseMetadata databaseMetadata) ! { ! secondPassCompile(); ! ! ArrayList script = new ArrayList(50); ! ! foreach(Table table in TableMappings) ! { ! TableMetadata tableInfo = databaseMetadata.GetTableMetadata( table.Name, table.Schema, null ); ! if (tableInfo == null) ! { ! script.Add( table.SqlCreateString( dialect, this ) ); ! } ! else ! { ! foreach(string alterString in table.SqlAlterStrings(dialect, this, tableInfo)) ! { ! script.Add( alterString ); ! } ! } ! } ! ! foreach(Table table in TableMappings) ! { ! TableMetadata tableInfo = databaseMetadata.GetTableMetadata( table.Name, table.Schema, null ); ! ! if ( dialect.HasAlterTable) ! { ! foreach(ForeignKey fk in table.ForeignKeyCollection) ! { ! bool create = tableInfo == null || ( tableInfo.getForeignKeyMetadata( fk.Name ) == null && ( ! // Icky workaround for MySQL bug: ! !( dialect is NHibernate.Dialect.MySQLDialect ) || table.GetIndex( fk.Name ) == null ) ! ); ! if ( create ) ! { ! script.Add( fk.SqlCreateString(dialect, mapping) ); ! } ! } ! } ! ! // Broken 'cos we don't generate these with names in SchemaExport ! foreach(Index index in table.IndexCollection) ! { ! if ( tableInfo == null || tableInfo.GetIndexMetadata( index.Name ) == null ) ! { ! script.Add( index.SqlCreateString( dialect, mapping ) ); ! } ! } ! ! // Broken 'cos we don't generate these with names in SchemaExport ! foreach(UniqueKey uk in table.UniqueKeyCollection) ! { ! if ( tableInfo == null || tableInfo.GetIndexMetadata( uk.Name ) == null ) ! { ! script.Add( uk.SqlCreateString( dialect, mapping ) ); ! } ! } ! } ! ! foreach(IPersistentIdentifierGenerator generator in CollectionGenerators(dialect)) ! { ! object key = generator.GeneratorKey(); ! if ( !databaseMetadata.IsSequence( key ) && !databaseMetadata.IsTable(key) ) ! { ! string[] lines = generator.SqlCreateStrings( dialect ); ! for (int i = 0; i < lines.Length; i++) script.Add( lines[i] ); ! } ! } ! ! return ArrayHelper.ToStringArray(script); ! } ! */ /// <remarks> *************** *** 662,687 **** log.Info( "processing foreign key constraints" ); foreach( Table table in TableMappings ) { ! foreach( ForeignKey fk in table.ForeignKeyCollection ) { ! if( fk.ReferencedTable == null ) { ! if( log.IsDebugEnabled ) ! { ! log.Debug( "resolving reference to class: " + fk.ReferencedClass.Name ); ! } ! PersistentClass referencedClass = ( PersistentClass ) classes[ fk.ReferencedClass ]; ! if( referencedClass == null ) ! { ! throw new MappingException( ! "An association from the table " + ! fk.Table.Name + ! " refers to an unmapped class: " + ! fk.ReferencedClass.Name ! ); ! } ! fk.ReferencedTable = referencedClass.Table; } } } --- 720,756 ---- log.Info( "processing foreign key constraints" ); + ISet done = new HashedSet(); foreach( Table table in TableMappings ) { ! SecondPassCompileForeignKeys( table, done ); ! } ! } ! ! private void SecondPassCompileForeignKeys( Table table, ISet done ) ! { ! foreach( ForeignKey fk in table.ForeignKeyCollection ) ! { ! if ( !done.Contains( fk ) ) { ! done.Add( fk ); ! if( log.IsDebugEnabled ) { ! log.Debug( "resolving reference to class: " + fk.ReferencedClass.Name ); } + PersistentClass referencedClass = ( PersistentClass ) classes[ fk.ReferencedClass ]; + if( referencedClass == null ) + { + throw new MappingException( + "An association from the table " + + fk.Table.Name + + " refers to an unmapped class: " + + fk.ReferencedClass.Name + ); + } + if ( referencedClass.IsJoinedSubclass ) + { + SecondPassCompileForeignKeys( referencedClass.Superclass.Table, done ); + } + fk.ReferencedTable = referencedClass.Table; } } *************** *** 721,730 **** { SecondPassCompile(); Hashtable copy = new Hashtable( properties ); - Settings settings = BuildSettings(); ConfigureCaches( settings ); ! return new SessionFactoryImpl( this, copy, interceptor, settings ); } --- 790,813 ---- { SecondPassCompile(); + Validate(); + Environment.VerifyProperties( properties ); Hashtable copy = new Hashtable( properties ); Settings settings = BuildSettings(); ConfigureCaches( settings ); ! return new SessionFactoryImpl( this, settings ); ! } ! ! private void Validate() ! { ! foreach( PersistentClass clazz in classes.Values ) ! { ! clazz.Validate( mapping ); ! } ! ! foreach( NHibernate.Mapping.Collection col in collections.Values ) ! { ! col.Validate( mapping ); ! } } *************** *** 902,906 **** } } - } --- 985,988 ---- *************** *** 1025,1029 **** strategy.Cache = cache; - } } --- 1107,1110 ---- Index: Settings.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Settings.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Settings.cs 31 Dec 2004 15:54:08 -0000 1.4 --- Settings.cs 6 Mar 2005 12:44:36 -0000 1.5 *************** *** 14,23 **** --- 14,31 ---- private bool _isShowSqlEnabled; private bool _isOuterJoinFetchEnabled; + private int maximumFetchDepth; private IDictionary _querySubstitutions; private Dialect.Dialect _dialect; + private int batchSize; + private bool scrollableResultSetsEnabled; + private bool getGeneratedKeysEnabled; + private int statementFetchSize; private IsolationLevel _isolationLevel; private IConnectionProvider _connectionProvider; private ITransactionFactory _transactionFactory; private string _sessionFactoryName; + private bool autoCreateSchema; + private bool autoDropSchema; + private bool autoUpdateSchema; private ICacheProvider _cacheProvider; private string _defaultSchemaName; *************** *** 39,42 **** --- 47,106 ---- /// <summary></summary> + public bool IsScrollableResultSetsEnabled + { + get { return scrollableResultSetsEnabled; } + set { scrollableResultSetsEnabled = value; } + } + + /// <summary></summary> + public bool IsGetGeneratedKeysEnabled + { + get { return getGeneratedKeysEnabled; } + set { getGeneratedKeysEnabled = value; } + } + + /// <summary></summary> + public int BatchSize + { + get { return batchSize; } + set { batchSize = value; } + } + + /// <summary></summary> + public int MaximumFetchDepth + { + get { return maximumFetchDepth; } + set { maximumFetchDepth = value; } + } + + /// <summary></summary> + public bool IsAutoCreateSchema + { + get { return autoCreateSchema; } + set { autoCreateSchema = value; } + } + + /// <summary></summary> + public bool IsAutoDropSchema + { + get { return autoDropSchema; } + set { autoDropSchema = value; } + } + + /// <summary></summary> + public bool IsAutoUpdateSchema + { + get { return autoCreateSchema; } + set { autoCreateSchema = value; } + } + + /// <summary></summary> + public int StatementFetchSize + { + get { return statementFetchSize; } + set { statementFetchSize = value; } + } + + /// <summary></summary> public IDictionary QuerySubstitutions { Index: SettingsFactory.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/SettingsFactory.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SettingsFactory.cs 31 Dec 2004 15:54:08 -0000 1.3 --- SettingsFactory.cs 6 Mar 2005 12:44:36 -0000 1.4 *************** *** 56,60 **** ! bool useOuterJoin = PropertiesHelper.GetBoolean( Environment.OuterJoin, properties, true ); log.Info( "use outer join fetching: " + useOuterJoin ); --- 56,60 ---- ! bool useOuterJoin = PropertiesHelper.GetBoolean( Environment.UseOuterJoin, properties, true ); log.Info( "use outer join fetching: " + useOuterJoin ); |
From: Paul H. <pha...@us...> - 2005-03-06 12:45:35
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21577/nhibernate/src/NHibernate/Engine Modified Files: Cascades.cs ISessionFactoryImplementor.cs ISessionImplementor.cs Key.cs Log Message: Refactored SessionImpl as per 2.1 for Save/Update Index: ISessionImplementor.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/ISessionImplementor.cs,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ISessionImplementor.cs 1 Mar 2005 16:24:46 -0000 1.30 --- ISessionImplementor.cs 6 Mar 2005 12:44:39 -0000 1.31 *************** *** 41,44 **** --- 41,45 ---- /// that the client is modifying it /// </summary> + /// TODO: (2.1) This method no longer required. void Dirty( PersistentCollection collection ); *************** *** 133,142 **** 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> --- 134,145 ---- object ImmediateLoad( System.Type persistentClass, object id ); ! /// <summary> ! /// Load an instance by a unique key that is not the primary key. ! /// </summary> ! /// <param name="persistentClass"></param> ! /// <param name="uniqueKeyPropertyName"></param> ! /// <param name="id"></param> ! /// <returns></returns> ! object LoadByUniqueKey( System.Type persistentClass, string uniqueKeyPropertyName, object id ); /// <summary> *************** *** 152,156 **** ISessionFactoryImplementor Factory { get; } - /// <summary> /// Get the prepared statement <c>Batcher</c> for this session --- 155,158 ---- *************** *** 334,337 **** --- 336,396 ---- ICollection GetOrphans( PersistentCollection coll ); + /// <summary> + /// Get a batch of uninitialized collection keys for this role + /// </summary> + /// <param name="collectionPersister"></param> + /// <param name="id"></param> + /// <param name="batchSize"></param> + /// <returns></returns> + object[] GetCollectionBatch( ICollectionPersister collectionPersister, object id, int batchSize ); + + /// <summary> + /// Get a batch of unloaded identifiers for this class + /// </summary> + /// <param name="clazz"></param> + /// <param name="id"></param> + /// <param name="batchSize"></param> + /// <returns></returns> + object[] GetClassBatch( System.Type clazz, object id, int batchSize ); + + /// <summary> + /// Register the entity as batch loadable, if enabled + /// </summary> + /// <param name="clazz"></param> + /// <param name="id"></param> + void ScheduleBatchLoad( System.Type clazz, object id ); + + /// <summary> + /// Execute an SQL Query + /// </summary> + /// <param name="sqlQuery"></param> + /// <param name="aliases"></param> + /// <param name="classes"></param> + /// <param name="queryParameters"></param> + /// <param name="querySpaces"></param> + /// <returns></returns> + IList FindBySQL( string sqlQuery, string[] aliases, System.Type[] classes, QueryParameters queryParameters, ICollection querySpaces ); + + /// <summary> + /// new in 2.1 no javadoc + /// </summary> + /// <param name="key"></param> + void AddNonExist( Key key ); + + /// <summary> + /// new in 2.1 no javadoc + /// </summary> + /// <param name="obj"></param> + /// <param name="copiedAlready"></param> + /// <returns></returns> + object Copy( object obj, IDictionary copiedAlready ); + + /// <summary> + /// new in 2.1 no javadoc + /// </summary> + /// <param name="key"></param> + /// <param name="collectionPersister"></param> + /// <returns></returns> + object GetCollectionOwner( object key, ICollectionPersister collectionPersister ); } } \ No newline at end of file Index: ISessionFactoryImplementor.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/ISessionFactoryImplementor.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ISessionFactoryImplementor.cs 1 Mar 2005 16:24:46 -0000 1.14 --- ISessionFactoryImplementor.cs 6 Mar 2005 12:44:39 -0000 1.15 *************** *** 15,31 **** { /// <summary> - /// TODO: determine if this is more appropriate for ISessionFactory - /// </summary> - IConnectionProvider ConnectionProvider { get; } - - /// <summary> - /// Gets the IsolationLevel an IDbTransaction should be set to. - /// </summary> - /// <remarks> - /// This is only applicable to manually controlled NHibernate Transactions. - /// </remarks> - IsolationLevel Isolation { get; } - - /// <summary> /// Get the persister for a class /// </summary> --- 15,18 ---- *************** *** 59,63 **** /// Is outerjoin fetching enabled? /// </summary> ! bool EnableJoinedFetch { get; } /// <summary> --- 46,60 ---- /// Is outerjoin fetching enabled? /// </summary> ! bool IsOuterJoinedFetchEnabled { get; } ! ! /// <summary> ! /// Are scrollable <tt>ResultSet</tt>s supported? ! /// </summary> ! bool IsScrollableResultSetsEnabled { get; } ! ! /// <summary> ! /// Get the database schema specified in <tt>hibernate.default_schema</tt> ! /// </summary> ! bool IsGetGeneratedKeysEnabled { get; } /// <summary> *************** *** 72,81 **** /// <summary> - /// Gets a boolean indicating if the sql statement should be prepared. The value - /// is read from <c>hibernate.prepare_sql</c>. - /// </summary> - bool PrepareSql { get; } - - /// <summary> /// Get the return types of a query /// </summary> --- 69,72 ---- *************** *** 85,88 **** --- 76,113 ---- /// <summary> + /// TODO: determine if this is more appropriate for ISessionFactory + /// </summary> + IConnectionProvider ConnectionProvider { get; } + + /// <summary> + /// Get the names of all persistent classes that implement/extend the given interface/class + /// </summary> + /// <param name="clazz"></param> + /// <returns></returns> + string[ ] GetImplementors( System.Type clazz ); + + /// <summary> + /// Get a class name, using query language imports + /// </summary> + /// <param name="name"></param> + /// <returns></returns> + string GetImportedClassName( string name ); + + /// <summary> + /// + /// </summary> + int BatchSize { get; } + + /// <summary> + /// + /// </summary> + int FetchSize { get; } + + /// <summary> + /// + /// </summary> + int MaximumFetchDepth { get; } + + /// <summary> /// Get the named parameter names for a query /// </summary> *************** *** 104,119 **** /// <summary> ! /// Get the names of all persistent classes that implement/extend the given interface/class /// </summary> ! /// <param name="clazz"></param> ! /// <returns></returns> ! string[ ] GetImplementors( System.Type clazz ); /// <summary> ! /// Get a class name, using query language imports /// </summary> ! /// <param name="name"></param> ! /// <returns></returns> ! string GetImportedClassName( string name ); } } \ No newline at end of file --- 129,145 ---- /// <summary> ! /// Gets the IsolationLevel an IDbTransaction should be set to. /// </summary> ! /// <remarks> ! /// This is only applicable to manually controlled NHibernate Transactions. ! /// </remarks> ! IsolationLevel Isolation { get; } ! /// <summary> ! /// Gets a boolean indicating if the sql statement should be prepared. The value ! /// is read from <c>hibernate.prepare_sql</c>. /// </summary> ! bool PrepareSql { get; } } } \ No newline at end of file Index: Cascades.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/Cascades.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Cascades.cs 1 Mar 2005 16:24:45 -0000 1.16 --- Cascades.cs 6 Mar 2005 12:44:38 -0000 1.17 *************** *** 101,105 **** return true; } - } --- 101,104 ---- *************** *** 124,128 **** return false; } - } --- 123,126 ---- *************** *** 162,167 **** public override bool ShouldCascadeCollection( object collection ) { - return CollectionIsInitialized( collection ); // saves/updates don't cascade to uninitialized collections } --- 160,165 ---- public override bool ShouldCascadeCollection( object collection ) { // saves/updates don't cascade to uninitialized collections + return CollectionIsInitialized( collection ); } *************** *** 170,174 **** --- 168,195 ---- return true; } + } + + /// <summary></summary> + public static CascadingAction ActionReplicate = new ActionReplicateClass(); + private class ActionReplicateClass : CascadingAction + { + public override void Cascade( ISessionImplementor session, object child, object anything ) + { + log.Debug( "cascading to Replicate()" ); + // TODO: 2.1 implement replication + //session.Replicate( child, (ReplicationMode) anything ); + } + + public override bool ShouldCascadeCollection( object collection ) + { + // replicate does cascade to uninitialized collections + return true; + } + + public override bool DeleteOrphans() + { + return false; // I suppose? + } } Index: Key.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/Key.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Key.cs 31 Dec 2004 17:36:40 -0000 1.8 --- Key.cs 6 Mar 2005 12:44:39 -0000 1.9 *************** *** 11,18 **** public sealed class Key { ! private object id; ! private object identifierSpace; ! private Key( object id, object identifierSpace ) { if( id == null ) --- 11,20 ---- public sealed class Key { ! private readonly object identifier; ! private readonly object identifierSpace; ! private readonly System.Type clazz; ! private readonly bool isBatchLoadable; ! private Key( object id, object identifierSpace, System.Type clazz, bool isBatchLoadable ) { if( id == null ) *************** *** 20,25 **** throw new ArgumentException( "null identifier", "id" ); } ! this.id = id; this.identifierSpace = identifierSpace; } --- 22,29 ---- throw new ArgumentException( "null identifier", "id" ); } ! this.identifier = id; this.identifierSpace = identifierSpace; + this.clazz = clazz; + this.isBatchLoadable = isBatchLoadable; } *************** *** 29,33 **** /// <param name="id"></param> /// <param name="p"></param> ! public Key( object id, IClassPersister p ) : this( id, p.IdentifierSpace ) { } --- 33,37 ---- /// <param name="id"></param> /// <param name="p"></param> ! public Key( object id, IClassPersister p ) : this( id, p.IdentifierSpace, p.MappedClass, p.IsBatchLoadable ) { } *************** *** 38,42 **** public object Identifier { ! get { return id; } } --- 42,62 ---- public object Identifier { ! get { return identifier; } ! } ! ! /// <summary> ! /// ! /// </summary> ! public System.Type MappedClass ! { ! get { return clazz; } ! } ! ! /// <summary> ! /// ! /// </summary> ! public bool IsBatchLoadable ! { ! get { return isBatchLoadable; } } *************** *** 53,57 **** return false; } ! return otherKey.identifierSpace.Equals( this.identifierSpace ) && otherKey.id.Equals( this.id ); } --- 73,77 ---- return false; } ! return otherKey.identifierSpace.Equals( this.identifierSpace ) && otherKey.Identifier.Equals( this.identifier ); } *************** *** 59,63 **** public override int GetHashCode() { ! return id.GetHashCode(); } --- 79,86 ---- public override int GetHashCode() { ! int result = 17; ! result = 37 * result + identifierSpace.GetHashCode(); ! result = 37 * result + identifier.GetHashCode(); ! return result; } *************** *** 65,69 **** public override string ToString() { ! return id.ToString(); } --- 88,92 ---- public override string ToString() { ! return identifier.ToString(); } |
From: Paul H. <pha...@us...> - 2005-03-06 12:45:35
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Id In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21577/nhibernate/src/NHibernate/Id Modified Files: IdentifierGeneratorFactory.cs IdentityGenerator.cs Log Message: Refactored SessionImpl as per 2.1 for Save/Update Index: IdentifierGeneratorFactory.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Id/IdentifierGeneratorFactory.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** IdentifierGeneratorFactory.cs 15 Jan 2005 21:16:13 -0000 1.14 --- IdentifierGeneratorFactory.cs 6 Mar 2005 12:44:42 -0000 1.15 *************** *** 111,115 **** /// <see cref="String.Empty">String.Empty</see> /// </value> ! public static readonly string ShortCircuitIndicator = String.Empty; /// <summary> --- 111,120 ---- /// <see cref="String.Empty">String.Empty</see> /// </value> ! public static readonly object ShortCircuitIndicator = new object(); ! ! /// <summary> ! /// When this is return ! /// </summary> ! public static readonly object IdentityColumnIndicator = new object(); /// <summary> Index: IdentityGenerator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Id/IdentityGenerator.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** IdentityGenerator.cs 15 Jan 2005 21:16:13 -0000 1.5 --- IdentityGenerator.cs 6 Mar 2005 12:44:42 -0000 1.6 *************** *** 24,40 **** /// <summary> ! /// This class can not generate the <c>id</c>. It has to get the ! /// value from the database. /// </summary> /// <param name="s">The <see cref="ISessionImplementor"/> this id is being generated in.</param> /// <param name="obj">The entity the id is being generated for.</param> /// <returns> ! /// <c>null</c> because this <see cref="IIdentifierGenerator"/> can not generate ! /// an id. The entity must be inserted into the database to get the database ! /// generated id. /// </returns> public object Generate( ISessionImplementor s, object obj ) { ! return null; } --- 24,39 ---- /// <summary> ! /// The IdentityGenerator for autoincrement/identity key generation. ! /// /// </summary> /// <param name="s">The <see cref="ISessionImplementor"/> this id is being generated in.</param> /// <param name="obj">The entity the id is being generated for.</param> /// <returns> ! /// <c>IdentityColumnIndicator</c> Indicates to the Session that identity (i.e. identity/autoincrement column) ! /// key generation should be used. /// </returns> public object Generate( ISessionImplementor s, object obj ) { ! return IdentifierGeneratorFactory.IdentityColumnIndicator; } |
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21577/nhibernate/src/NHibernate/Impl Modified Files: AbstractQueryImpl.cs BatcherImpl.cs EntityEntry.cs IExecutable.cs ScheduledCollectionAction.cs ScheduledCollectionRemove.cs ScheduledDeletion.cs ScheduledEntityAction.cs ScheduledInsertion.cs ScheduledUpdate.cs SessionFactoryImpl.cs SessionImpl.cs Added Files: BatchingBatcher.cs OnReplicateVisitor.cs ScheduledIdentityInsertion.cs SqlQueryImpl.cs Log Message: Refactored SessionImpl as per 2.1 for Save/Update Index: SessionImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionImpl.cs,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** SessionImpl.cs 1 Mar 2005 16:24:47 -0000 1.68 --- SessionImpl.cs 6 Mar 2005 12:44:42 -0000 1.69 *************** *** 34,39 **** private SessionFactoryImpl factory; ! private bool autoClose; ! private long timestamp; /// <summary> --- 34,39 ---- private SessionFactoryImpl factory; ! private readonly bool autoClose; [...1642 lines suppressed...] + { + return null; + } + + if ( obj is IHibenateProxy ) + { + ILazyInitializer li = HibernateProxyHelper. + } + + if ( copiedAlready.Contains( obj ) + { + return obj; // EARLY EXIT! + } + */ + + return null; + } } } \ No newline at end of file Index: BatcherImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/BatcherImpl.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** BatcherImpl.cs 31 Jan 2005 03:25:39 -0000 1.17 --- BatcherImpl.cs 6 Mar 2005 12:44:42 -0000 1.18 *************** *** 15,19 **** internal abstract class BatcherImpl : IBatcher { ! private static readonly ILog log = LogManager.GetLogger( typeof( BatcherImpl ) ); private static int openCommandCount; --- 15,19 ---- internal abstract class BatcherImpl : IBatcher { ! protected static readonly ILog log = LogManager.GetLogger( typeof( BatcherImpl ) ); private static int openCommandCount; Index: AbstractQueryImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/AbstractQueryImpl.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractQueryImpl.cs 1 Mar 2005 16:24:47 -0000 1.1 --- AbstractQueryImpl.cs 6 Mar 2005 12:44:42 -0000 1.2 *************** *** 662,666 **** /// <summary></summary> ! public IType[ ] ReturnTypes { get { return session.Factory.GetReturnTypes( queryString ); } --- 662,666 ---- /// <summary></summary> ! public virtual IType[ ] ReturnTypes { get { return session.Factory.GetReturnTypes( queryString ); } Index: SessionFactoryImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionFactoryImpl.cs,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** SessionFactoryImpl.cs 1 Mar 2005 16:24:46 -0000 1.42 --- SessionFactoryImpl.cs 6 Mar 2005 12:44:42 -0000 1.43 *************** *** 18,21 **** --- 18,22 ---- using NHibernate.Transaction; using NHibernate.Type; + using NHibernate.Tool.hbm2ddl; using HibernateDialect = NHibernate.Dialect.Dialect; *************** *** 56,92 **** internal class SessionFactoryImpl : ISessionFactory, ISessionFactoryImplementor, IObjectReference { ! private static readonly ILog log = LogManager.GetLogger( typeof( SessionFactoryImpl ) ); [NonSerialized] ! private Settings settings; ! private string name; ! private string uuid; [NonSerialized] ! private IDictionary classPersisters; [NonSerialized] ! private IDictionary classPersistersByName; [NonSerialized] ! private IDictionary collectionPersisters; [NonSerialized] ! private IDictionary namedQueries; [NonSerialized] ! private IDictionary imports; [NonSerialized] ! private IDictionary properties; // templates are related to XmlDatabinder - nothing like that yet // in NHibernate. //[NonSerialized] private Templates templates; [NonSerialized] ! private IInterceptor interceptor; ! private static IIdentifierGenerator uuidgen = new UUIDHexGenerator(); /// <summary> --- 57,106 ---- internal class SessionFactoryImpl : ISessionFactory, ISessionFactoryImplementor, IObjectReference { ! private readonly string name; ! private readonly string uuid; [NonSerialized] ! private readonly IDictionary classPersisters; ! [NonSerialized] ! private readonly IDictionary classPersistersByName; [NonSerialized] ! private readonly IDictionary classMetadata; [NonSerialized] ! private readonly IDictionary collectionPersisters; [NonSerialized] ! private readonly IDictionary collectionMetadata; [NonSerialized] ! private readonly IDictionary namedQueries; [NonSerialized] ! private readonly IDictionary namedSqlQueries; [NonSerialized] ! private readonly IDictionary imports; // templates are related to XmlDatabinder - nothing like that yet // in NHibernate. //[NonSerialized] private Templates templates; + [NonSerialized] ! private readonly IInterceptor interceptor; ! [NonSerialized] ! private readonly Settings settings; ! ! [NonSerialized] ! private readonly IDictionary properties; ! ! [NonSerialized] ! private SchemaExport schemaExport; ! ! private static readonly IIdentifierGenerator uuidgen = new UUIDHexGenerator(); ! ! private static readonly ILog log = LogManager.GetLogger( typeof( SessionFactoryImpl ) ); /// <summary> *************** *** 94,103 **** /// </summary> /// <param name="cfg"></param> - /// <param name="properties"></param> - /// <param name="interceptor"></param> /// <param name="settings"></param> ! public SessionFactoryImpl( Configuration cfg, IDictionary properties, IInterceptor interceptor, Settings settings ) { log.Info( "building session factory" ); if( log.IsDebugEnabled ) { --- 108,120 ---- /// </summary> /// <param name="cfg"></param> /// <param name="settings"></param> ! public SessionFactoryImpl( Configuration cfg, Settings settings ) { log.Info( "building session factory" ); + + this.properties = cfg.Properties; + this.interceptor = cfg.Interceptor; + this.settings = settings; + if( log.IsDebugEnabled ) { *************** *** 110,121 **** } - this.interceptor = interceptor; - this.properties = properties; - this.settings = settings; - // Persisters: classPersisters = new Hashtable(); classPersistersByName = new Hashtable(); foreach( PersistentClass model in cfg.ClassMappings ) --- 127,135 ---- } // Persisters: classPersisters = new Hashtable(); classPersistersByName = new Hashtable(); + IDictionary classMeta = new Hashtable(); foreach( PersistentClass model in cfg.ClassMappings ) *************** *** 136,148 **** // Imports provide the ability to jump from the Classname to the AssemblyQualifiedName. classPersistersByName[ model.MappedClass.AssemblyQualifiedName ] = cp; } collectionPersisters = new Hashtable(); foreach( Mapping.Collection map in cfg.CollectionMappings ) { - //collectionPersisters[ map.Role ] = new CollectionPersister( map, cfg, this ); collectionPersisters[ map.Role ] = PersisterFactory.CreateCollectionPersister( cfg, map, this ); } foreach( IClassPersister persister in classPersisters.Values ) { --- 150,166 ---- // Imports provide the ability to jump from the Classname to the AssemblyQualifiedName. classPersistersByName[ model.MappedClass.AssemblyQualifiedName ] = cp; + + classMeta[ model.MappedClass ] = cp.ClassMetadata; } + classMetadata = new Hashtable( classMeta ); collectionPersisters = new Hashtable(); foreach( Mapping.Collection map in cfg.CollectionMappings ) { collectionPersisters[ map.Role ] = PersisterFactory.CreateCollectionPersister( cfg, map, this ); } + collectionMetadata = new Hashtable( collectionPersisters ); + // after *all* persisters are registered foreach( IClassPersister persister in classPersisters.Values ) { *************** *** 166,174 **** SessionFactoryObjectFactory.AddInstance( uuid, name, this, properties ); ! namedQueries = cfg.NamedQueries; imports = new Hashtable( cfg.Imports ); log.Debug( "Instantiated session factory" ); } --- 184,217 ---- SessionFactoryObjectFactory.AddInstance( uuid, name, this, properties ); ! // Named queries: ! // TODO: precompile and cache named queries ! namedQueries = new Hashtable( cfg.NamedQueries ); ! namedSqlQueries = new Hashtable( cfg.NamedSQLQueries.Count ); ! foreach ( NamedSQLQuery nsq in cfg.NamedSQLQueries ) ! { ! namedSqlQueries[ nsq.QueryString ] = new InternalNamedSQLQuery( nsq.QueryString, nsq.ReturnAliases, nsq.ReturnClasses, nsq.SynchronizedTables ); ! } ! ! imports = new Hashtable( cfg.Imports ); log.Debug( "Instantiated session factory" ); + if ( settings.IsAutoCreateSchema ) + { + new SchemaExport( cfg ).Create( false, true ); + } + + /* + if ( settings.IsAutoUpdateSchema ) + { + new SchemaUpdate( cfg ).Execute( false, true ); + } + */ + + if ( settings.IsAutoDropSchema ) + { + schemaExport = new SchemaExport( cfg ); + } } *************** *** 328,331 **** --- 371,392 ---- /// <summary></summary> + public int MaximumFetchDepth + { + get { return settings.MaximumFetchDepth; } + } + + /// <summary></summary> + public bool IsShowSqlEnabled + { + get { return settings.IsShowSqlEnabled; } + } + + /// <summary></summary> + public int FetchSize + { + get { return settings.StatementFetchSize; } + } + + /// <summary></summary> public IConnectionProvider ConnectionProvider { *************** *** 570,574 **** /// <summary></summary> ! public bool EnableJoinedFetch { get { return settings.IsOuterJoinFetchEnabled; } --- 631,659 ---- /// <summary></summary> ! public bool IsBatchUpdateEnabled ! { ! get { return settings.BatchSize > 0; } ! } ! ! /// <summary></summary> ! public int BatchSize ! { ! get { return settings.BatchSize; } ! } ! ! /// <summary></summary> ! public bool IsScrollableResultSetsEnabled ! { ! get { return settings.IsScrollableResultSetsEnabled; } ! } ! ! /// <summary></summary> ! public bool IsGetGeneratedKeysEnabled ! { ! get { return settings.IsGetGeneratedKeysEnabled; } ! } ! ! /// <summary></summary> ! public bool IsOuterJoinedFetchEnabled { get { return settings.IsOuterJoinFetchEnabled; } *************** *** 593,596 **** --- 678,691 ---- /// /// </summary> + /// <param name="queryName"></param> + /// <returns></returns> + public InternalNamedSQLQuery GetNamedSQLQuery( string queryName ) + { + return namedSqlQueries[ queryName ] as InternalNamedSQLQuery; + } + + /// <summary> + /// + /// </summary> /// <param name="objectClass"></param> /// <returns></returns> *************** *** 864,867 **** --- 959,977 ---- /// /// </summary> + public void EvictQueries( ) + { + } + + /// <summary> + /// + /// </summary> + /// <param name="cacheRegion"></param> + public void EvictQueries( string cacheRegion ) + { + } + + /// <summary> + /// + /// </summary> /// <param name="roleName"></param> public void EvictCollection( string roleName ) *************** *** 874,877 **** --- 984,1023 ---- } + // TODO: a better way to normalised the NamedSQLQUery aspect + internal class InternalNamedSQLQuery + { + private readonly string queryString; + private readonly string[] returnAliases; + private readonly System.Type[] returnClasses; + private readonly IList querySpaces; + + public InternalNamedSQLQuery( string query, string[] aliases, System.Type[] clazz, IList querySpaces ) + { + this.returnClasses = clazz; + this.returnAliases = aliases; + this.queryString = query; + this.querySpaces = querySpaces; + } + + public string[] ReturnAliases + { + get { return returnAliases; } + } + + public System.Type[] ReturnClasses + { + get { return returnClasses; } + } + + public string QueryString + { + get { return queryString; } + } + + public ICollection QuerySpaces + { + get { return querySpaces; } + } + } } } \ No newline at end of file --- NEW FILE: ScheduledIdentityInsertion.cs --- using NHibernate.Engine; using NHibernate.Persister; namespace NHibernate.Impl { /// <summary> /// Summary description for ScheduledIdentityInsertion. /// </summary> internal sealed class ScheduledIdentityInsertion : ScheduledEntityAction, IExecutable { private readonly object[] state; private CacheEntry cacheEntry; private object generatedId; /// <summary> /// /// </summary> /// <param name="state"></param> /// <param name="instance"></param> /// <param name="persister"></param> /// <param name="session"></param> public ScheduledIdentityInsertion( object[] state, object instance, IClassPersister persister, ISessionImplementor session ) : base( session, null, instance, persister ) { this.state = state; } public override void Execute() { IClassPersister persister = Persister; ISessionImplementor session = Session; object obj = Instance; // Don't need to lock the cache here, since if someone // else inserted the same pk first, the insert would fail. generatedId = persister.Insert( state, obj, session ); // TODO: This bit has to be called after all the cascades /* if ( persister.HasCache && !persister.IsCacheInvalidationRequired ) { cacheEntry = new CacheEntry( obj, persister, session ); persister.Cache.Put( generatedId, cacheEntry, 0 ); } */ } public override void AfterTransactionCompletion( ) { // TODO: renable /* IClassPersister persister = Persister; if ( success && persister.HasCache && !persister.IsCacheInvalidationRequired ) { persister.Cache.AfterInsert( GeneratedId, cacheEntry ); } */ } /// <summary> /// /// </summary> // TODO: Remove once AfterTransactionCompletion is active public override bool HasAfterTransactionCompletion { get { return false; } } public object GeneratedId { get { return generatedId; } } } } Index: ScheduledDeletion.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/ScheduledDeletion.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ScheduledDeletion.cs 1 Mar 2005 16:24:46 -0000 1.6 --- ScheduledDeletion.cs 6 Mar 2005 12:44:42 -0000 1.7 *************** *** 10,15 **** internal class ScheduledDeletion : ScheduledEntityAction { ! private object _version; ! private ISoftLock _lock; /// <summary> --- 10,15 ---- internal class ScheduledDeletion : ScheduledEntityAction { ! private object version; ! private ISoftLock lck; /// <summary> *************** *** 24,28 **** : base( session, id, instance, persister ) { ! _version = version; } --- 24,28 ---- : base( session, id, instance, persister ) { ! this.version = version; } *************** *** 32,38 **** if( Persister.HasCache ) { ! _lock = Persister.Cache.Lock( Id ); } ! Persister.Delete( Id, _version, Instance, Session ); Session.PostDelete( Instance ); } --- 32,38 ---- if( Persister.HasCache ) { ! lck = Persister.Cache.Lock( Id, version ); } ! Persister.Delete( Id, version, Instance, Session ); Session.PostDelete( Instance ); } *************** *** 43,47 **** if( Persister.HasCache ) { ! Persister.Cache.Release( Id, _lock ); } } --- 43,47 ---- if( Persister.HasCache ) { ! Persister.Cache.Release( Id, lck ); } } Index: ScheduledInsertion.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/ScheduledInsertion.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ScheduledInsertion.cs 31 Dec 2004 19:53:54 -0000 1.5 --- ScheduledInsertion.cs 6 Mar 2005 12:44:42 -0000 1.6 *************** *** 9,13 **** internal class ScheduledInsertion : ScheduledEntityAction { ! private readonly object[ ] _state; /// <summary> --- 9,15 ---- internal class ScheduledInsertion : ScheduledEntityAction { ! private readonly object[ ] state; ! private CacheEntry entry; ! private readonly object version; /// <summary> *************** *** 17,26 **** /// <param name="state">An object array that contains the state of the object being inserted.</param> /// <param name="instance">The actual object instance.</param> /// <param name="persister">The <see cref="IClassPersister"/> that is responsible for the persisting the object.</param> /// <param name="session">The <see cref="ISessionImplementor"/> that the Action is occuring in.</param> ! public ScheduledInsertion( object id, object[ ] state, object instance, IClassPersister persister, ISessionImplementor session ) : base( session, id, instance, persister ) { ! _state = state; } --- 19,30 ---- /// <param name="state">An object array that contains the state of the object being inserted.</param> /// <param name="instance">The actual object instance.</param> + /// <param name="version">The version of the object instance.</param> /// <param name="persister">The <see cref="IClassPersister"/> that is responsible for the persisting the object.</param> /// <param name="session">The <see cref="ISessionImplementor"/> that the Action is occuring in.</param> ! public ScheduledInsertion( object id, object[ ] state, object instance, object version, IClassPersister persister, ISessionImplementor session ) : base( session, id, instance, persister ) { ! this.state = state; ! this.version = version; } *************** *** 28,33 **** public override void Execute() { ! Persister.Insert( Id, _state, Instance, Session ); Session.PostInsert( Instance ); } --- 32,45 ---- public override void Execute() { ! Persister.Insert( Id, state, Instance, Session ); Session.PostInsert( Instance ); + + /* + if ( Persister.HasCache && Persister.IsCacheInvalidationRequired ) + { + cacheEntry = new CacheEntry( Instance, Persister, Session ); + Persister.Cache.Put( Id, cacheEntry ); + } + */ } *************** *** 35,39 **** public override void AfterTransactionCompletion() { ! // do nothing } } --- 47,58 ---- public override void AfterTransactionCompletion() { ! // Make 100% certain that this is called before any subsequent ScheduledUpdate.AfterTransactionCompletion()!! ! /* ! if ( Persister.HasCache && Persister.IsCacheInvalidationRequired ) ! { ! cacheEntry = new CacheEntry( Instance, Persister, Session ); ! Persister.Cache.AfterInsert( Id, cacheEntry, version ); ! } ! */ } } Index: EntityEntry.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/EntityEntry.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EntityEntry.cs 1 Jan 2005 02:35:07 -0000 1.2 --- EntityEntry.cs 6 Mar 2005 12:44:42 -0000 1.3 *************** *** 14,27 **** private static readonly log4net.ILog log = log4net.LogManager.GetLogger( typeof(EntityEntry) ); ! private LockMode _lockMode; ! private Status _status; ! private object _id; ! private object[] _loadedState; ! private object[] _deletedState; ! private bool _existsInDatabase; ! private object _version; // for convenience to save some lookups ! [NonSerialized] private IClassPersister _persister; ! private string _className; /// <summary> --- 14,28 ---- private static readonly log4net.ILog log = log4net.LogManager.GetLogger( typeof(EntityEntry) ); ! private LockMode lockMode; ! private Status status; ! private object id; ! private object[] loadedState; ! private object[] deletedState; ! private bool existsInDatabase; ! private object version; // for convenience to save some lookups ! [NonSerialized] private IClassPersister persister; ! private string className; ! private bool isBeingReplicated; /// <summary> *************** *** 35,48 **** /// <param name="existsInDatabase">A boolean indicating if the Entity exists in the database.</param> /// <param name="persister">The <see cref="IClassPersister"/> that is responsible for this Entity.</param> ! public EntityEntry(Status status, object[] loadedState, object id, object version, LockMode lockMode, bool existsInDatabase, IClassPersister persister) { ! _status = status; ! _loadedState = loadedState; ! _id = id; ! _existsInDatabase = existsInDatabase; ! _version = version; ! _lockMode = lockMode; ! _persister = persister; ! if (_persister!=null) _className = _persister.ClassName; } --- 36,54 ---- /// <param name="existsInDatabase">A boolean indicating if the Entity exists in the database.</param> /// <param name="persister">The <see cref="IClassPersister"/> that is responsible for this Entity.</param> ! /// <param name="disableVersionIncrement"></param> ! public EntityEntry(Status status, object[] loadedState, object id, object version, LockMode lockMode, bool existsInDatabase, IClassPersister persister, bool disableVersionIncrement ) { ! this.status = status; ! this.loadedState = loadedState; ! this.id = id; ! this.existsInDatabase = existsInDatabase; ! this.version = version; ! this.lockMode = lockMode; ! this.isBeingReplicated = disableVersionIncrement; ! this.persister = persister; ! if ( persister != null ) ! { ! className = persister.ClassName; ! } } *************** *** 53,58 **** public LockMode LockMode { ! get { return _lockMode; } ! set { _lockMode = value; } } --- 59,64 ---- public LockMode LockMode { ! get { return lockMode; } ! set { lockMode = value; } } *************** *** 64,69 **** public Status Status { ! get { return _status; } ! set { _status = value; } } --- 70,75 ---- public Status Status { ! get { return status; } ! set { status = value; } } *************** *** 76,81 **** public object Id { ! get { return _id; } ! set { _id = value; } } --- 82,87 ---- public object Id { ! get { return id; } ! set { id = value; } } *************** *** 89,94 **** public object[] LoadedState { ! get { return _loadedState; } ! set { _loadedState = value; } } --- 95,100 ---- public object[] LoadedState { ! get { return loadedState; } ! set { loadedState = value; } } *************** *** 100,105 **** public object[] DeletedState { ! get { return _deletedState; } ! set { _deletedState = value; } } --- 106,111 ---- public object[] DeletedState { ! get { return deletedState; } ! set { deletedState = value; } } *************** *** 114,119 **** public bool ExistsInDatabase { ! get { return _existsInDatabase; } ! set { _existsInDatabase = value; } } --- 120,125 ---- public bool ExistsInDatabase { ! get { return existsInDatabase; } ! set { existsInDatabase = value; } } *************** *** 124,129 **** public object Version { ! get { return _version; } ! set { _version = value; } } --- 130,135 ---- public object Version { ! get { return version; } ! set { version = value; } } *************** *** 134,139 **** public IClassPersister Persister { ! get { return _persister; } ! set { _persister = value; } } --- 140,145 ---- public IClassPersister Persister { ! get { return persister; } ! set { persister = value; } } *************** *** 144,151 **** public string ClassName { ! get { return _className; } } } - } --- 150,163 ---- public string ClassName { ! get { return className; } } + /// <summary> + /// + /// </summary> + public bool IsBeingReplicated + { + get { return isBeingReplicated; } + } } } --- NEW FILE: SqlQueryImpl.cs --- using System; using System.Collections; using NHibernate.Engine; using NHibernate.Type; namespace NHibernate.Impl { /// <summary> /// Implements SQL query passthrough /// <pre> /// <sql-query-name name="mySqlQuery"> /// <return alias="person" class="eg.Person" /> /// SELECT {person}.NAME AS {person.name}, {person}.AGE AS {person.age}, {person}.SEX AS {person.sex} /// FROM PERSON {person} WHERE {person}.NAME LIKE 'Hiber%' /// </sql-query-name> /// </pre> /// </summary> internal class SqlQueryImpl : AbstractQueryImpl { private readonly System.Type[] returnClasses; private readonly string[] returnAliases; private readonly ICollection querySpaces; /// <summary> /// /// </summary> /// <param name="sql"></param> /// <param name="returnAliases"></param> /// <param name="returnClasses"></param> /// <param name="session"></param> /// <param name="querySpaces"></param> public SqlQueryImpl( string sql, string[] returnAliases, System.Type[] returnClasses, ISessionImplementor session, ICollection querySpaces) : base( sql, session ) { this.returnClasses = returnClasses; this.returnAliases = returnAliases; this.querySpaces = querySpaces; } /// <summary> /// /// </summary> public string[] ReturnAliases { get { return returnAliases; } } /// <summary> /// /// </summary> public System.Type[] ReturnClasses { get { return returnClasses; } } /// <summary> /// /// </summary> public override IType[] ReturnTypes { get { IType[] types = new IType[ returnClasses.Length ]; for ( int i = 0; i < returnClasses.Length; i++ ) { types[ i ] = NHibernateUtil.Entity( returnClasses[ i ] ); } return types; } } /// <summary> /// /// </summary> /// <returns></returns> public override IList List() { VerifyParameters(); IDictionary namedParams = NamedParams; return Session.FindBySQL( BindParameterLists( namedParams ), returnAliases, returnClasses, QueryParams( namedParams ), querySpaces ); } /// <summary></summary> public override IEnumerable Enumerable() { throw new NotSupportedException( "SQL queries do not currently support enumeration" ); } } } --- NEW FILE: BatchingBatcher.cs --- using System; using System.Data; using NHibernate.Engine; namespace NHibernate.Impl { /// <summary> /// Summary description for BatchingBatcher. /// </summary> internal class BatchingBatcher : BatcherImpl { private int batchSize; private int[] expectedRowCounts; /// <summary> /// /// </summary> /// <param name="session"></param> public BatchingBatcher( ISessionImplementor session ) : base( session ) { expectedRowCounts = new int[ Factory.BatchSize ]; } /// <summary> /// /// </summary> /// <param name="expectedRowCount"></param> public override void AddToBatch( int expectedRowCount ) { throw new NotImplementedException( "Batching not implemented yet" ); /* log.Info( "Adding to batch" ); IDbCommand batchUpdate = CurrentStatment; */ } /// <summary> /// /// </summary> /// <param name="ps"></param> protected override void DoExecuteBatch( IDbCommand ps ) { throw new NotImplementedException( "Batching not implemented yet" ); } } } Index: ScheduledCollectionAction.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/ScheduledCollectionAction.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ScheduledCollectionAction.cs 1 Mar 2005 16:24:46 -0000 1.10 --- ScheduledCollectionAction.cs 6 Mar 2005 12:44:42 -0000 1.11 *************** *** 11,18 **** internal abstract class ScheduledCollectionAction : IExecutable { ! private ICollectionPersister _persister; ! private object _id; ! private ISessionImplementor _session; ! private ISoftLock _lock = null; /// <summary> --- 11,19 ---- internal abstract class ScheduledCollectionAction : IExecutable { ! private ICollectionPersister persister; ! private object id; ! private ISessionImplementor session; ! private ISoftLock lck = null; ! private string collectionRole; /// <summary> *************** *** 24,30 **** public ScheduledCollectionAction( ICollectionPersister persister, object id, ISessionImplementor session ) { ! _persister = persister; ! _session = session; ! _id = id; } --- 25,32 ---- public ScheduledCollectionAction( ICollectionPersister persister, object id, ISessionImplementor session ) { ! this.persister = persister; ! this.session = session; ! this.id = id; ! this.collectionRole = persister.Role; } *************** *** 34,38 **** public ICollectionPersister Persister { ! get { return _persister; } } --- 36,40 ---- public ICollectionPersister Persister { ! get { return persister; } } *************** *** 42,46 **** public object Id { ! get { return _id; } } --- 44,48 ---- public object Id { ! get { return id; } } *************** *** 50,54 **** public ISessionImplementor Session { ! get { return _session; } } --- 52,56 ---- public ISessionImplementor Session { ! get { return session; } } *************** *** 58,73 **** public void AfterTransactionCompletion() { ! if ( _persister.HasCache ) { ! _persister.Cache.Release( _id, _lock ); } } public abstract void Execute(); /// <summary></summary> public object[ ] PropertySpaces { ! get { return new object[ ] {_persister.CollectionSpace}; } //TODO: cache the array on the persister } --- 60,97 ---- public void AfterTransactionCompletion() { ! if ( persister.HasCache ) { ! persister.Cache.Release( id, lck ); } } + public bool HasAfterTransactionCompletion + { + get { return persister.HasCache; } + } + public abstract void Execute(); + /// <summary> + /// + /// </summary> + public void BeforeExecutions( ) + { + // we need to obtain the lock before any actions are + // executed, since this may be an inverse="true" + // bidirectional association and it is one of the + // earlier entity actions which actually updates + // the database (this action is resposible for + // second-level cache invalidation only) + if ( persister.HasCache ) + { + lck = persister.Cache.Lock( id, null ); //collections don't have version numbers :-( + } + } + /// <summary></summary> public object[ ] PropertySpaces { ! get { return new object[ ] { persister.CollectionSpace }; } //TODO: cache the array on the persister } Index: IExecutable.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/IExecutable.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IExecutable.cs 31 Dec 2004 19:51:46 -0000 1.2 --- IExecutable.cs 6 Mar 2005 12:44:42 -0000 1.3 *************** *** 8,11 **** --- 8,16 ---- { /// <summary> + /// + /// </summary> + void BeforeExecutions(); + + /// <summary> /// Execute the action required to write changes to the database. /// </summary> *************** *** 13,16 **** --- 18,26 ---- /// <summary> + /// Does the executable have an AfterTransactionCompletion process + /// </summary> + bool HasAfterTransactionCompletion { get; } + + /// <summary> /// Called after the Transaction has been completed. /// </summary> Index: ScheduledEntityAction.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/ScheduledEntityAction.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ScheduledEntityAction.cs 31 Dec 2004 19:53:44 -0000 1.8 --- ScheduledEntityAction.cs 6 Mar 2005 12:44:42 -0000 1.9 *************** *** 1,2 **** --- 1,3 ---- + using System; using NHibernate.Engine; using NHibernate.Persister; *************** *** 10,17 **** internal abstract class ScheduledEntityAction : IExecutable { ! private readonly ISessionImplementor _session; ! private readonly object _id; ! private readonly IClassPersister _persister; ! private readonly object _instance; /// <summary> --- 11,18 ---- internal abstract class ScheduledEntityAction : IExecutable { ! private readonly ISessionImplementor session; ! private readonly object id; ! private readonly IClassPersister persister; ! private readonly object instance; /// <summary> *************** *** 24,31 **** protected ScheduledEntityAction( ISessionImplementor session, object id, object instance, IClassPersister persister ) { ! _session = session; ! _id = id; ! _persister = persister; ! _instance = instance; } --- 25,32 ---- protected ScheduledEntityAction( ISessionImplementor session, object id, object instance, IClassPersister persister ) { ! this.session = session; ! this.id = id; ! this.persister = persister; ! this.instance = instance; } *************** *** 36,40 **** protected ISessionImplementor Session { ! get { return _session; } } --- 37,41 ---- protected ISessionImplementor Session { ! get { return session; } } *************** *** 44,48 **** protected object Id { ! get { return _id; } } --- 45,49 ---- protected object Id { ! get { return id; } } *************** *** 52,56 **** protected IClassPersister Persister { ! get { return _persister; } } --- 53,57 ---- protected IClassPersister Persister { ! get { return persister; } } *************** *** 60,64 **** protected object Instance { ! get { return _instance; } } --- 61,65 ---- protected object Instance { ! get { return instance; } } *************** *** 66,69 **** --- 67,87 ---- /// <summary> + /// + /// </summary> + /// <remarks>Not supported for a non-collection entity</remarks> + public void BeforeExecutions( ) + { + throw new NotSupportedException( "BeforeExecutions() called for non-collection method" ); + } + + /// <summary> + /// + /// </summary> + public virtual bool HasAfterTransactionCompletion + { + get { return persister.HasCache; } + } + + /// <summary> /// Called when the Transaction this action occurred in has completed. /// </summary> *************** *** 78,82 **** public object[ ] PropertySpaces { ! get { return _persister.PropertySpaces; } } --- 96,100 ---- public object[ ] PropertySpaces { ! get { return persister.PropertySpaces; } } --- NEW FILE: OnReplicateVisitor.cs --- using NHibernate.Collection; using NHibernate.Type; namespace NHibernate.Impl { /// <summary> /// When an entity is passed to Update(), we must inspect all its collections and /// 1. associate any uninitialized PersistentCollections with this session /// 2. associate any initialized PersistentCollections with this session, using the existing snapshot /// 3. execute a collection removal (SQL DELETE) for each null collection property or "new" collection /// </summary> internal class OnReplicateVisitor : ReattachVisitor { public OnReplicateVisitor( SessionImpl session, object key ) : base( session, key ) { } protected override object ProcessCollection( object collection, PersistentCollectionType type ) { SessionImpl session = Session; object key = Key; ICollectionPersister persister = session.GetCollectionPersister( type.Role ); session.RemoveCollection( persister, key ); if ( collection != null && ( collection is PersistentCollection ) ) { PersistentCollection wrapper = collection as PersistentCollection; wrapper.SetCurrentSession( session ); if ( wrapper.WasInitialized ) { session.AddNewCollection( wrapper, persister ); } else { session.ReattachCollection( wrapper, wrapper.CollectionSnapshot ) ; } } else { // otherwise a null or brand new collection // this will also (inefficiently) handle arrays, which // have no snapshot, so we can't do any better //processArrayOrNewCollection(collection, type); } return null; } } } Index: ScheduledUpdate.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/ScheduledUpdate.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ScheduledUpdate.cs 1 Mar 2005 16:24:46 -0000 1.9 --- ScheduledUpdate.cs 6 Mar 2005 12:44:42 -0000 1.10 *************** *** 44,48 **** if( Persister.HasCache ) { ! _lock = Persister.Cache.Lock( Id ); } Persister.Update( Id, _fields, _dirtyFields, _lastVersion, Instance, Session ); --- 44,48 ---- if( Persister.HasCache ) { ! _lock = Persister.Cache.Lock( Id, _lastVersion ); } Persister.Update( Id, _fields, _dirtyFields, _lastVersion, Instance, Session ); Index: ScheduledCollectionRemove.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/ScheduledCollectionRemove.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ScheduledCollectionRemove.cs 1 Mar 2005 16:24:46 -0000 1.7 --- ScheduledCollectionRemove.cs 6 Mar 2005 12:44:42 -0000 1.8 *************** *** 30,36 **** public override void Execute() { if ( Persister.HasCache ) { ! Persister.Cache.Lock( Id ); } --- 30,37 ---- public override void Execute() { + // TODO: 2.1 Remove this clause if ( Persister.HasCache ) { ! Persister.Cache.Lock( Id, null ); } |
From: Paul H. <pha...@us...> - 2005-03-06 12:45:31
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21577/nhibernate/src/NHibernate Modified Files: ISessionFactory.cs NHibernate-1.1.csproj Added Files: ReplicationMode.cs Log Message: Refactored SessionImpl as per 2.1 for Save/Update Index: NHibernate-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate-1.1.csproj,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** NHibernate-1.1.csproj 1 Mar 2005 16:24:42 -0000 1.75 --- NHibernate-1.1.csproj 6 Mar 2005 12:44:39 -0000 1.76 *************** *** 280,283 **** --- 280,288 ---- /> <File + RelPath = "ReplicationMode.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "StaleObjectStateException.cs" SubType = "Code" *************** *** 1060,1063 **** --- 1065,1073 ---- /> <File + RelPath = "Impl\BatchingBatcher.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Impl\CacheEntry.cs" SubType = "Code" *************** *** 1130,1133 **** --- 1140,1148 ---- /> <File + RelPath = "Impl\OnReplicateVisitor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Impl\OnUpdateVisitor.cs" SubType = "Code" *************** *** 1180,1183 **** --- 1195,1203 ---- /> <File + RelPath = "Impl\ScheduledIdentityInsertion.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Impl\ScheduledInsertion.cs" SubType = "Code" *************** *** 1205,1208 **** --- 1225,1233 ---- /> <File + RelPath = "Impl\SqlQueryImpl.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Impl\Status.cs" SubType = "Code" *************** *** 1220,1223 **** --- 1245,1253 ---- /> <File + RelPath = "Loader\BatchingCollectionInitializer.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Loader\CollectionLoader.cs" SubType = "Code" Index: ISessionFactory.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/ISessionFactory.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ISessionFactory.cs 31 Dec 2004 23:57:31 -0000 1.6 --- ISessionFactory.cs 6 Mar 2005 12:44:39 -0000 1.7 *************** *** 108,112 **** void Evict( System.Type persistentClass, object id ); - /// <summary> /// Evict all entries from the process-level cache. This method occurs outside --- 108,111 ---- *************** *** 125,128 **** --- 124,138 ---- /// <param name="id"></param> void EvictCollection( string roleName, object id ); + + /// <summary> + /// Evict any query result sets cached in the default query cache region. + /// </summary> + void EvictQueries( ); + + /// <summary> + /// Evict any query result sets cached in the named query cache region. + /// </summary> + /// <param name="cacheRegion"></param> + void EvictQueries( string cacheRegion ); } } \ No newline at end of file --- NEW FILE: ReplicationMode.cs --- using System; using System.Collections; using NHibernate.Type; namespace NHibernate { /// <summary> /// Represents a replication strategy /// </summary> public abstract class ReplicationMode { private readonly int code; private readonly string name; private static readonly IDictionary Instances = new Hashtable(); /// <summary> /// /// </summary> /// <param name="level"></param> /// <param name="name"></param> public ReplicationMode( int level, string name ) { this.code = level; this.name = name; } /// <summary> /// /// </summary> /// <param name="entity"></param> /// <param name="currentVersion"></param> /// <param name="newVersion"></param> /// <param name="versionType"></param> /// <returns></returns> public abstract bool ShouldOverwriteCurrentVersion( object entity, object currentVersion, object newVersion, IVersionType versionType ); /// <summary></summary> public static readonly ReplicationMode Exception = new ExceptionReplicationMode( 0, "EXCEPTION" ); private sealed class ExceptionReplicationMode : ReplicationMode { public ExceptionReplicationMode( int level, string name ) : base( level, name ) { } /// <summary> /// Throw an exception when a row already exists /// </summary> /// <param name="entity"></param> /// <param name="currentVersion"></param> /// <param name="newVersion"></param> /// <param name="versionType"></param> /// <returns></returns> public override bool ShouldOverwriteCurrentVersion( object entity, object currentVersion, object newVersion, IVersionType versionType ) { throw new NotSupportedException( "should not be called" ); } } /// <summary></summary> public static readonly ReplicationMode Ignore = new IgnoreReplicationMode( 1, "IGNORE" ); private sealed class IgnoreReplicationMode : ReplicationMode { public IgnoreReplicationMode( int level, string name ) : base( level, name ) { } /// <summary> /// Ignore replicated entities when a row already exists /// </summary> /// <param name="entity"></param> /// <param name="currentVersion"></param> /// <param name="newVersion"></param> /// <param name="versionType"></param> /// <returns></returns> public override bool ShouldOverwriteCurrentVersion( object entity, object currentVersion, object newVersion, IVersionType versionType ) { return false; } } /// <summary></summary> public static readonly ReplicationMode Overwrite = new OverwriteReplicationMode( 3, "OVERWRITE" ); private sealed class OverwriteReplicationMode : ReplicationMode { public OverwriteReplicationMode( int level, string name ) : base( level, name ) { } /// <summary> /// Overwrite existing rows when a row already exists /// </summary> /// <param name="entity"></param> /// <param name="currentVersion"></param> /// <param name="newVersion"></param> /// <param name="versionType"></param> /// <returns></returns> public override bool ShouldOverwriteCurrentVersion( object entity, object currentVersion, object newVersion, IVersionType versionType ) { return true; } } /// <summary></summary> public static readonly ReplicationMode LatestVersion = new LatestVersionReplicationMode( 2, "LATEST_VERSION" ); private sealed class LatestVersionReplicationMode : ReplicationMode { public LatestVersionReplicationMode( int level, string name ) : base( level, name ) { } /// <summary> /// When a row already exists, choose the latest version /// </summary> /// <param name="entity"></param> /// <param name="currentVersion"></param> /// <param name="newVersion"></param> /// <param name="versionType"></param> /// <returns></returns> public override bool ShouldOverwriteCurrentVersion( object entity, object currentVersion, object newVersion, IVersionType versionType ) { if ( versionType == null ) { // always overwrite nonversioned data return true; } // TODO: 2.1 implement Comparator on versionType //return versionType.Comparator.Compare( currentVersion, newVersion ) <= 0; return true; } } } } |
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21577/nhibernate/src/NHibernate/Dialect Modified Files: DB2Dialect.cs MsSql2000Dialect.cs MySQLDialect.cs Oracle9Dialect.cs PostgreSQLDialect.cs SybaseDialect.cs Log Message: Refactored SessionImpl as per 2.1 for Save/Update Index: PostgreSQLDialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PostgreSQLDialect.cs 1 Mar 2005 16:24:44 -0000 1.16 --- PostgreSQLDialect.cs 6 Mar 2005 12:44:37 -0000 1.17 *************** *** 56,60 **** RegisterColumnType( DbType.Time, "time" ); ! DefaultProperties[ Environment.OuterJoin ] = "true"; DefaultProperties[ Environment.ConnectionDriver ] = "NHibernate.Driver.NpgsqlDriver"; } --- 56,60 ---- RegisterColumnType( DbType.Time, "time" ); ! DefaultProperties[ Environment.UseOuterJoin ] = "true"; DefaultProperties[ Environment.ConnectionDriver ] = "NHibernate.Driver.NpgsqlDriver"; } Index: DB2Dialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/DB2Dialect.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** DB2Dialect.cs 1 Mar 2005 16:24:44 -0000 1.10 --- DB2Dialect.cs 6 Mar 2005 12:44:36 -0000 1.11 *************** *** 127,131 **** RegisterFunction("ltrim", new StandardSQLFunction() ); ! DefaultProperties[ Environment.OuterJoin ] = "true"; DefaultProperties[ Environment.ConnectionDriver ] = "NHibernate.Driver.DB2Driver"; } --- 127,131 ---- RegisterFunction("ltrim", new StandardSQLFunction() ); ! DefaultProperties[ Environment.UseOuterJoin ] = "true"; DefaultProperties[ Environment.ConnectionDriver ] = "NHibernate.Driver.DB2Driver"; } Index: SybaseDialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/SybaseDialect.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** SybaseDialect.cs 31 Dec 2004 17:07:24 -0000 1.12 --- SybaseDialect.cs 6 Mar 2005 12:44:37 -0000 1.13 *************** *** 31,35 **** */ ! DefaultProperties[ Environment.OuterJoin ] = "true"; } --- 31,35 ---- */ ! DefaultProperties[ Environment.UseOuterJoin ] = "true"; } Index: MsSql2000Dialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** MsSql2000Dialect.cs 1 Mar 2005 16:24:44 -0000 1.25 --- MsSql2000Dialect.cs 6 Mar 2005 12:44:37 -0000 1.26 *************** *** 141,145 **** RegisterFunction("ltrim", new StandardSQLFunction() ); ! DefaultProperties[ Environment.OuterJoin ] = "true"; DefaultProperties[ Environment.ConnectionDriver ] = "NHibernate.Driver.SqlClientDriver"; DefaultProperties[ Environment.PrepareSql ] = "false"; --- 141,145 ---- RegisterFunction("ltrim", new StandardSQLFunction() ); ! DefaultProperties[ Environment.UseOuterJoin ] = "true"; DefaultProperties[ Environment.ConnectionDriver ] = "NHibernate.Driver.SqlClientDriver"; DefaultProperties[ Environment.PrepareSql ] = "false"; Index: Oracle9Dialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/Oracle9Dialect.cs,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Oracle9Dialect.cs 1 Mar 2005 16:24:44 -0000 1.21 --- Oracle9Dialect.cs 6 Mar 2005 12:44:37 -0000 1.22 *************** *** 37,41 **** { // DefaultProperties[Cfg.Environment.UseStreamsForBinary] = "true"; ! DefaultProperties[ Environment.OuterJoin ] = "true"; DefaultProperties[ Environment.ConnectionDriver ] = "NHibernate.Driver.OracleClientDriver"; --- 37,41 ---- { // DefaultProperties[Cfg.Environment.UseStreamsForBinary] = "true"; ! DefaultProperties[ Environment.UseOuterJoin ] = "true"; DefaultProperties[ Environment.ConnectionDriver ] = "NHibernate.Driver.OracleClientDriver"; Index: MySQLDialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/MySQLDialect.cs,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** MySQLDialect.cs 1 Mar 2005 16:24:44 -0000 1.27 --- MySQLDialect.cs 6 Mar 2005 12:44:37 -0000 1.28 *************** *** 69,73 **** RegisterColumnType( DbType.Time, "TIME" ); ! DefaultProperties[ Environment.OuterJoin ] = "true"; DefaultProperties[ Environment.ConnectionDriver ] = "NHibernate.Driver.MySqlDataDriver"; } --- 69,73 ---- RegisterColumnType( DbType.Time, "TIME" ); ! DefaultProperties[ Environment.UseOuterJoin ] = "true"; DefaultProperties[ Environment.ConnectionDriver ] = "NHibernate.Driver.MySqlDataDriver"; } |
From: Paul H. <pha...@us...> - 2005-03-06 12:45:22
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21577/nhibernate/src/NHibernate/Cache Modified Files: ICacheConcurrencyStrategy.cs NonstrictReadWriteCache.cs ReadOnlyCache.cs ReadWriteCache.cs Log Message: Refactored SessionImpl as per 2.1 for Save/Update Index: ReadWriteCache.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/ReadWriteCache.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ReadWriteCache.cs 1 Mar 2005 16:24:43 -0000 1.8 --- ReadWriteCache.cs 6 Mar 2005 12:44:35 -0000 1.9 *************** *** 70,74 **** /// </summary> /// <param name="key"></param> ! public ISoftLock Lock( object key ) { // TODO: Differs from the 2.1 implementation --- 70,75 ---- /// </summary> /// <param name="key"></param> ! /// <param name="version"></param> ! public ISoftLock Lock( object key, object version ) { // TODO: Differs from the 2.1 implementation Index: NonstrictReadWriteCache.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/NonstrictReadWriteCache.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** NonstrictReadWriteCache.cs 1 Mar 2005 16:24:43 -0000 1.5 --- NonstrictReadWriteCache.cs 6 Mar 2005 12:44:35 -0000 1.6 *************** *** 93,97 **** /// </summary> /// <param name="key"></param> ! public ISoftLock Lock( object key ) { // TODO: Differs from the 2.1 implemenation --- 93,98 ---- /// </summary> /// <param name="key"></param> ! /// <param name="version"></param> ! public ISoftLock Lock( object key, object version ) { // TODO: Differs from the 2.1 implemenation Index: ReadOnlyCache.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/ReadOnlyCache.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ReadOnlyCache.cs 1 Mar 2005 16:24:43 -0000 1.9 --- ReadOnlyCache.cs 6 Mar 2005 12:44:35 -0000 1.10 *************** *** 53,57 **** /// </summary> /// <param name="key"></param> ! public ISoftLock Lock( object key ) { log.Error( "Application attempted to edit read only item: " + key ); --- 53,58 ---- /// </summary> /// <param name="key"></param> ! /// <param name="version"></param> ! public ISoftLock Lock( object key, object version ) { log.Error( "Application attempted to edit read only item: " + key ); Index: ICacheConcurrencyStrategy.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/ICacheConcurrencyStrategy.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ICacheConcurrencyStrategy.cs 1 Mar 2005 16:24:43 -0000 1.6 --- ICacheConcurrencyStrategy.cs 6 Mar 2005 12:44:34 -0000 1.7 *************** *** 39,45 **** /// </summary> /// <param name="key">The key</param> /// <exception cref="CacheException"></exception> /// <remarks>This method is used by "asynchronous" concurrency strategies.</remarks> ! ISoftLock Lock( object key ); /// <summary> --- 39,46 ---- /// </summary> /// <param name="key">The key</param> + /// <param name="version"></param> /// <exception cref="CacheException"></exception> /// <remarks>This method is used by "asynchronous" concurrency strategies.</remarks> ! ISoftLock Lock( object key, object version ); /// <summary> |
From: Paul H. <pha...@us...> - 2005-03-06 12:45:22
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21577/nhibernate/src/NHibernate.DomainModel Modified Files: CustomPersister.cs Log Message: Refactored SessionImpl as per 2.1 for Save/Update Index: CustomPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/CustomPersister.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CustomPersister.cs 1 Mar 2005 16:24:41 -0000 1.4 --- CustomPersister.cs 6 Mar 2005 12:44:32 -0000 1.5 *************** *** 25,28 **** --- 25,29 ---- private static readonly string[] Names = new string[] { "name" }; private static readonly bool[] Mutability = new bool[] { true }; + private static readonly bool[] Nullability = new bool[] { true }; public CustomPersister(PersistentClass model, ISessionFactory factory ) *************** *** 61,65 **** public bool[] PropertyUpdateability { ! get { return Mutability; } } --- 62,76 ---- public bool[] PropertyUpdateability { ! get { return Mutability; } ! } ! ! public bool[] PropertyNullability ! { ! get { return Nullability; } ! } ! ! public bool IsBatchLoadable ! { ! get { return false; } } |
From: Paul H. <pha...@us...> - 2005-03-06 12:45:22
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21577/nhibernate/src/NHibernate.Test Modified Files: FooBarTest.cs Log Message: Refactored SessionImpl as per 2.1 for Save/Update Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** FooBarTest.cs 19 Feb 2005 17:58:04 -0000 1.84 --- FooBarTest.cs 6 Mar 2005 12:44:34 -0000 1.85 *************** *** 350,354 **** public void ForceOuterJoin() { ! if( ((Engine.ISessionFactoryImplementor)sessions).EnableJoinedFetch==false ) { // don't bother to run the test if we can't test it --- 350,354 ---- public void ForceOuterJoin() { ! if( ((Engine.ISessionFactoryImplementor)sessions).IsOuterJoinedFetchEnabled == false ) { // don't bother to run the test if we can't test it *************** *** 3639,3643 **** Assert.IsTrue( baz.FooArray[0] is Proxy.INHibernateProxy ); //many-to-many Assert.AreEqual( bar2prox, baz.FooArray[1] ); ! if( ((Engine.ISessionFactoryImplementor)sessions).EnableJoinedFetch ) { enumer = baz.FooBag.GetEnumerator(); --- 3639,3643 ---- Assert.IsTrue( baz.FooArray[0] is Proxy.INHibernateProxy ); //many-to-many Assert.AreEqual( bar2prox, baz.FooArray[1] ); ! if( ((Engine.ISessionFactoryImplementor)sessions).IsOuterJoinedFetchEnabled ) { enumer = baz.FooBag.GetEnumerator(); |
From: Paul H. <pha...@us...> - 2005-03-06 12:45:22
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/CacheTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21577/nhibernate/src/NHibernate.Test/CacheTest Modified Files: CacheFixture.cs Log Message: Refactored SessionImpl as per 2.1 for Save/Update Index: CacheFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/CacheTest/CacheFixture.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CacheFixture.cs 1 Mar 2005 16:24:41 -0000 1.4 --- CacheFixture.cs 6 Mar 2005 12:44:33 -0000 1.5 *************** *** 45,49 **** // update it; ! ccs.Lock("foo"); Assert.IsNull( ccs.Get("foo", after) ); --- 45,49 ---- // update it; ! ccs.Lock("foo", null); Assert.IsNull( ccs.Get("foo", after) ); *************** *** 82,87 **** // update it again, with multiple locks ! ccs.Lock("foo"); ! ccs.Lock("foo"); Assert.IsNull( ccs.Get("foo", longLongAfter) ); --- 82,87 ---- // update it again, with multiple locks ! ccs.Lock("foo", null); ! ccs.Lock("foo", null); Assert.IsNull( ccs.Get("foo", longLongAfter) ); |