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: Kevin W. <kev...@us...> - 2004-12-31 21:50:07
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3612 Modified Files: PersisterFactory.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: PersisterFactory.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/PersisterFactory.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PersisterFactory.cs 9 Aug 2004 03:25:55 -0000 1.1 --- PersisterFactory.cs 31 Dec 2004 21:49:57 -0000 1.2 *************** *** 1,5 **** using System; using System.Reflection; - using NHibernate.Engine; using NHibernate.Mapping; --- 1,4 ---- *************** *** 19,23 **** } ! private static readonly System.Type[] PersisterConstructorArgs = new System.Type[] { typeof(PersistentClass), typeof(ISessionFactoryImplementor) }; --- 18,22 ---- } ! private static readonly System.Type[ ] PersisterConstructorArgs = new System.Type[ ] {typeof( PersistentClass ), typeof( ISessionFactoryImplementor )}; *************** *** 28,46 **** /// <param name="factory"></param> /// <returns></returns> ! public static IClassPersister Create(PersistentClass model, ISessionFactoryImplementor factory) { System.Type persisterClass = model.Persister; ! if( persisterClass==null || persisterClass==typeof(EntityPersister) ) { ! return new EntityPersister(model, factory); } ! else if ( persisterClass==typeof(NormalizedEntityPersister) ) { ! return new NormalizedEntityPersister(model, factory); } ! else { ! return Create(persisterClass, model, factory); } } --- 27,45 ---- /// <param name="factory"></param> /// <returns></returns> ! public static IClassPersister Create( PersistentClass model, ISessionFactoryImplementor factory ) { System.Type persisterClass = model.Persister; ! if( persisterClass == null || persisterClass == typeof( EntityPersister ) ) { ! return new EntityPersister( model, factory ); } ! else if( persisterClass == typeof( NormalizedEntityPersister ) ) { ! return new NormalizedEntityPersister( model, factory ); } ! else { ! return Create( persisterClass, model, factory ); } } *************** *** 53,76 **** /// <param name="factory"></param> /// <returns></returns> ! public static IClassPersister Create(System.Type persisterClass, PersistentClass model, ISessionFactoryImplementor factory ) { ConstructorInfo pc; ! try { ! pc = persisterClass.GetConstructor(PersisterFactory.PersisterConstructorArgs); } ! catch(Exception e) { ! throw new MappingException("Could not get constructor for " + persisterClass.Name, e); } ! try { ! return (IClassPersister) pc.Invoke( new object[] {model, factory} ); } ! //TODO: add more specialized error catches ! catch (Exception e) { ! throw new MappingException("Could not instantiate persister " + persisterClass.Name, e); } --- 52,75 ---- /// <param name="factory"></param> /// <returns></returns> ! public static IClassPersister Create( System.Type persisterClass, PersistentClass model, ISessionFactoryImplementor factory ) { ConstructorInfo pc; ! try { ! pc = persisterClass.GetConstructor( PersisterFactory.PersisterConstructorArgs ); } ! catch( Exception e ) { ! throw new MappingException( "Could not get constructor for " + persisterClass.Name, e ); } ! try { ! return ( IClassPersister ) pc.Invoke( new object[ ] {model, factory} ); } ! //TODO: add more specialized error catches ! catch( Exception e ) { ! throw new MappingException( "Could not instantiate persister " + persisterClass.Name, e ); } *************** *** 78,80 **** } ! } --- 77,79 ---- } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 21:49:57
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3574 Modified Files: IQueryable.cs NormalizedEntityPersister.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: NormalizedEntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/NormalizedEntityPersister.cs,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** NormalizedEntityPersister.cs 4 Dec 2004 22:41:29 -0000 1.36 --- NormalizedEntityPersister.cs 31 Dec 2004 21:49:46 -0000 1.37 *************** *** 2,9 **** using System.Collections; using System.Data; - using System.Text; - using Iesi.Collections; ! using NHibernate.Engine; using NHibernate.Hql; --- 2,7 ---- using System.Collections; [...3035 lines suppressed...] ! if( HasWhere ) { ! result = result.Append( " and " + GetSQLWhereString( alias ) ); } ! return result; } ! ! /// <summary></summary> ! public override string[ ] IdentifierColumnNames { ! get { return tableKeyColumns[ 0 ]; } } ! } ! } \ No newline at end of file Index: IQueryable.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/IQueryable.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** IQueryable.cs 16 Aug 2004 05:22:56 -0000 1.8 --- IQueryable.cs 31 Dec 2004 21:49:46 -0000 1.9 *************** *** 1,8 **** - using System; - using NHibernate.SqlCommand; using NHibernate.Type; ! namespace NHibernate.Persister { /// <summary> --- 1,6 ---- using NHibernate.SqlCommand; using NHibernate.Type; ! namespace NHibernate.Persister { /// <summary> *************** *** 10,14 **** /// by the query language /// </summary> ! public interface IQueryable : ILoadable { /// <summary> --- 8,12 ---- /// by the query language /// </summary> ! public interface IQueryable : ILoadable { /// <summary> *************** *** 38,42 **** /// <param name="path"></param> /// <returns></returns> ! IType GetPropertyType(string path); /// <summary> --- 36,40 ---- /// <param name="path"></param> /// <returns></returns> ! IType GetPropertyType( string path ); /// <summary> *************** *** 47,52 **** /// <param name="includeSublcasses"></param> /// <returns></returns> ! SqlString QueryWhereFragment(string alias, bool innerJoin, bool includeSublcasses); ! /// <summary> /// Given a query alias and a property path, return the qualified column name --- 45,50 ---- /// <param name="includeSublcasses"></param> /// <returns></returns> ! SqlString QueryWhereFragment( string alias, bool innerJoin, bool includeSublcasses ); ! /// <summary> /// Given a query alias and a property path, return the qualified column name *************** *** 55,59 **** /// <param name="property"></param> /// <returns></returns> ! string[] ToColumns(string alias, string property); } ! } --- 53,57 ---- /// <param name="property"></param> /// <returns></returns> ! string[ ] ToColumns( string alias, string property ); } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 21:49:44
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3522 Modified Files: IClassPersister.cs ILoadable.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: IClassPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/IClassPersister.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** IClassPersister.cs 2 Sep 2004 15:11:01 -0000 1.7 --- IClassPersister.cs 31 Dec 2004 21:49:35 -0000 1.8 *************** *** 1,11 **** - using System; using System.Reflection; - using NHibernate.Type; using NHibernate.Cache; using NHibernate.Engine; using NHibernate.Id; using NHibernate.Metadata; ! namespace NHibernate.Persister { /// <summary> --- 1,10 ---- using System.Reflection; using NHibernate.Cache; using NHibernate.Engine; using NHibernate.Id; using NHibernate.Metadata; + using NHibernate.Type; ! namespace NHibernate.Persister { /// <summary> *************** *** 16,22 **** /// (PersistentClass, SessionFactoryImplementor) /// </remarks> ! public interface IClassPersister { - /// <summary> /// Finish the initialization of this object, once all <c>ClassPersisters</c> have been --- 15,20 ---- /// (PersistentClass, SessionFactoryImplementor) /// </remarks> ! public interface IClassPersister { /// <summary> /// Finish the initialization of this object, once all <c>ClassPersisters</c> have been *************** *** 24,28 **** /// </summary> /// <param name="factory"></param> ! void PostInstantiate(ISessionFactoryImplementor factory); /// <summary> --- 22,26 ---- /// </summary> /// <param name="factory"></param> ! void PostInstantiate( ISessionFactoryImplementor factory ); /// <summary> *************** *** 36,42 **** /// instance are persisted. eg. table names. /// </summary> - /// <param name="instance"></param> /// <returns></returns> ! object[] PropertySpaces { get; } /// <summary> --- 34,39 ---- /// instance are persisted. eg. table names. /// </summary> /// <returns></returns> ! object[ ] PropertySpaces { get; } /// <summary> *************** *** 69,73 **** /// proxy interfaces for all subclasses /// </summary> ! System.Type[] ProxyInterfaces { get; } /// <summary> --- 66,70 ---- /// proxy interfaces for all subclasses /// </summary> ! System.Type[ ] ProxyInterfaces { get; } /// <summary> *************** *** 105,109 **** /// <param name="id"></param> /// <returns></returns> ! bool IsUnsaved(object id); /// <summary> --- 102,106 ---- /// <param name="id"></param> /// <returns></returns> ! bool IsUnsaved( object id ); /// <summary> *************** *** 112,116 **** /// <param name="obj"></param> /// <param name="values"></param> ! void SetPropertyValues(object obj, object[] values); /// <summary> --- 109,113 ---- /// <param name="obj"></param> /// <param name="values"></param> ! void SetPropertyValues( object obj, object[ ] values ); /// <summary> *************** *** 119,123 **** /// <param name="obj"></param> /// <returns></returns> ! object[] GetPropertyValues(object obj); /// <summary> --- 116,120 ---- /// <param name="obj"></param> /// <returns></returns> ! object[ ] GetPropertyValues( object obj ); /// <summary> *************** *** 127,131 **** /// <param name="i"></param> /// <param name="value"></param> ! void SetPropertyValue(object obj, int i, object value); /// <summary> --- 124,128 ---- /// <param name="i"></param> /// <param name="value"></param> ! void SetPropertyValue( object obj, int i, object value ); /// <summary> *************** *** 135,139 **** /// <param name="i"></param> /// <returns></returns> ! object GetPropertyValue(object obj, int i); /// <summary> --- 132,136 ---- /// <param name="i"></param> /// <returns></returns> ! object GetPropertyValue( object obj, int i ); /// <summary> *************** *** 146,150 **** /// <param name="session"></param> /// <returns><c>null</c> or the indices of the dirty properties</returns> ! int[] FindDirty(object[] x, object[] y, object owner, ISessionImplementor session); /// <summary> --- 143,147 ---- /// <param name="session"></param> /// <returns><c>null</c> or the indices of the dirty properties</returns> ! int[ ] FindDirty( object[ ] x, object[ ] y, object owner, ISessionImplementor session ); /// <summary> *************** *** 158,162 **** /// </summary> /// <returns><c>true if there is a Identifier Property or Composite Identifier.</c></returns> ! bool HasIdentifierPropertyOrEmbeddedCompositeIdentifier{get;} /// <summary> --- 155,159 ---- /// </summary> /// <returns><c>true if there is a Identifier Property or Composite Identifier.</c></returns> ! bool HasIdentifierPropertyOrEmbeddedCompositeIdentifier { get; } /// <summary> *************** *** 165,169 **** /// <param name="obj"></param> /// <returns></returns> ! object GetIdentifier(object obj); /// <summary> --- 162,166 ---- /// <param name="obj"></param> /// <returns></returns> ! object GetIdentifier( object obj ); /// <summary> *************** *** 172,176 **** /// <param name="obj">The object to set the Id property on.</param> /// <param name="id">The value to set the Id property to.</param> ! void SetIdentifier(object obj, object id); /// <summary> --- 169,173 ---- /// <param name="obj">The object to set the Id property on.</param> /// <param name="id">The value to set the Id property to.</param> ! void SetIdentifier( object obj, object id ); /// <summary> *************** *** 199,203 **** /// <param name="obj"></param> /// <returns></returns> ! object GetVersion(object obj); /// <summary> --- 196,200 ---- /// <param name="obj"></param> /// <returns></returns> ! object GetVersion( object obj ); /// <summary> *************** *** 206,210 **** /// <param name="id"></param> /// <returns></returns> ! object Instantiate(object id); /// <summary> --- 203,207 ---- /// <param name="id"></param> /// <returns></returns> ! object Instantiate( object id ); /// <summary> *************** *** 221,226 **** /// <param name="session"></param> /// <returns></returns> ! object Load(object id, object optionalObject, LockMode lockMode, ISessionImplementor session); ! /// <summary> /// Do a version check (optional operation) --- 218,223 ---- /// <param name="session"></param> /// <returns></returns> ! object Load( object id, object optionalObject, LockMode lockMode, ISessionImplementor session ); ! /// <summary> /// Do a version check (optional operation) *************** *** 231,236 **** /// <param name="lockMode"></param> /// <param name="session"></param> ! void Lock(object id, object version, object obj, LockMode lockMode, ISessionImplementor session); ! /// <summary> /// Persist an instance --- 228,233 ---- /// <param name="lockMode"></param> /// <param name="session"></param> ! void Lock( object id, object version, object obj, LockMode lockMode, ISessionImplementor session ); ! /// <summary> /// Persist an instance *************** *** 240,244 **** /// <param name="obj"></param> /// <param name="session"></param> ! void Insert(object id, object[] fields, object obj, ISessionImplementor session); /// <summary> --- 237,241 ---- /// <param name="obj"></param> /// <param name="session"></param> ! void Insert( object id, object[ ] fields, object obj, ISessionImplementor session ); /// <summary> *************** *** 249,253 **** /// <param name="session"></param> /// <returns></returns> ! object Insert(object[] fields, object obj, ISessionImplementor session); /// <summary> --- 246,250 ---- /// <param name="session"></param> /// <returns></returns> ! object Insert( object[ ] fields, object obj, ISessionImplementor session ); /// <summary> *************** *** 258,262 **** /// <param name="obj"></param> /// <param name="session"></param> ! void Delete(object id, object version, object obj, ISessionImplementor session); /// <summary> --- 255,259 ---- /// <param name="obj"></param> /// <param name="session"></param> ! void Delete( object id, object version, object obj, ISessionImplementor session ); /// <summary> *************** *** 269,278 **** /// <param name="obj"></param> /// <param name="session"></param> ! void Update(object id, object[] fields, int[] dirtyFields, object oldVersion, object obj, ISessionImplementor session); ! /// <summary> /// Get the Hibernate types of the class properties /// </summary> ! IType[] PropertyTypes { get; } /// <summary> --- 266,275 ---- /// <param name="obj"></param> /// <param name="session"></param> ! void Update( object id, object[ ] fields, int[ ] dirtyFields, object oldVersion, object obj, ISessionImplementor session ); ! /// <summary> /// Get the Hibernate types of the class properties /// </summary> ! IType[ ] PropertyTypes { get; } /// <summary> *************** *** 280,284 **** /// .NET properties (used for XML generation only) /// </summary> ! string[] PropertyNames { get; } /// <summary> --- 277,281 ---- /// .NET properties (used for XML generation only) /// </summary> ! string[ ] PropertyNames { get; } /// <summary> *************** *** 289,293 **** /// This is for formula columns and if the user sets the update attribute on the <property> element. /// </remarks> ! bool[] PropertyUpdateability { get; } /// <summary> --- 286,290 ---- /// This is for formula columns and if the user sets the update attribute on the <property> element. /// </remarks> ! bool[ ] PropertyUpdateability { get; } /// <summary> *************** *** 298,307 **** /// This is for formula columns and if the user sets the insert attribute on the <property> element. /// </remarks> ! bool[] PropertyInsertability { get; } /// <summary> /// Get the cascade styles of the properties (optional operation) /// </summary> ! Cascades.CascadeStyle[] PropertyCascadeStyles { get; } /// <summary> --- 295,304 ---- /// This is for formula columns and if the user sets the insert attribute on the <property> element. /// </remarks> ! bool[ ] PropertyInsertability { get; } /// <summary> /// Get the cascade styles of the properties (optional operation) /// </summary> ! Cascades.CascadeStyle[ ] PropertyCascadeStyles { get; } /// <summary> *************** *** 330,335 **** /// </summary> IClassMetadata ClassMetadata { get; } ! ! } ! } --- 327,332 ---- /// </summary> IClassMetadata ClassMetadata { get; } ! ! } ! } \ No newline at end of file Index: ILoadable.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/ILoadable.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ILoadable.cs 16 Aug 2004 05:22:56 -0000 1.7 --- ILoadable.cs 31 Dec 2004 21:49:35 -0000 1.8 *************** *** 1,9 **** - using System; - using NHibernate.Loader; using NHibernate.SqlCommand; using NHibernate.Type; ! namespace NHibernate.Persister { /// <summary> --- 1,7 ---- using NHibernate.Loader; using NHibernate.SqlCommand; using NHibernate.Type; ! namespace NHibernate.Persister { /// <summary> *************** *** 11,15 **** /// operations used only by loaders that inherit <c>OuterJoinLoader</c> /// </summary> ! public interface ILoadable : IClassPersister { /// <summary> --- 9,13 ---- /// operations used only by loaders that inherit <c>OuterJoinLoader</c> /// </summary> ! public interface ILoadable : IClassPersister { /// <summary> *************** *** 22,30 **** /// </summary> string TableName { get; } ! /// <summary> /// The names of columns used to persist the identifier /// </summary> ! string[] IdentifierColumnNames { get; } /// <summary> --- 20,28 ---- /// </summary> string TableName { get; } ! /// <summary> /// The names of columns used to persist the identifier /// </summary> ! string[ ] IdentifierColumnNames { get; } /// <summary> *************** *** 43,47 **** /// <param name="value"></param> /// <returns></returns> ! System.Type GetSubclassForDiscriminatorValue(object value); /// <summary> --- 41,45 ---- /// <param name="value"></param> /// <returns></returns> ! System.Type GetSubclassForDiscriminatorValue( object value ); /// <summary> *************** *** 50,58 **** /// <param name="i"></param> /// <returns></returns> ! string[] GetPropertyColumnNames(int i); - //USED BY OuterJoinLoader + subclasses ! /// <summary> /// How many properties are there, for this class and all subclasses? (optional operation) --- 48,56 ---- /// <param name="i"></param> /// <returns></returns> ! string[ ] GetPropertyColumnNames( int i ); ! //USED BY OuterJoinLoader + subclasses ! /// <summary> /// How many properties are there, for this class and all subclasses? (optional operation) *************** *** 66,70 **** /// <param name="i"></param> /// <returns></returns> ! OuterJoinLoaderType EnableJoinedFetch(int i); /// <summary> --- 64,68 ---- /// <param name="i"></param> /// <returns></returns> ! OuterJoinLoaderType EnableJoinedFetch( int i ); /// <summary> *************** *** 73,77 **** /// <param name="i"></param> /// <returns></returns> ! bool IsDefinedOnSubclass(int i); /// <summary> --- 71,75 ---- /// <param name="i"></param> /// <returns></returns> ! bool IsDefinedOnSubclass( int i ); /// <summary> *************** *** 80,84 **** /// <param name="i"></param> /// <returns></returns> ! IType GetSubclassPropertyType(int i); /// <summary> --- 78,82 ---- /// <param name="i"></param> /// <returns></returns> ! IType GetSubclassPropertyType( int i ); /// <summary> *************** *** 88,92 **** /// <param name="i"></param> /// <returns></returns> ! string GetSubclassPropertyName(int i); /// <summary> --- 86,90 ---- /// <param name="i"></param> /// <returns></returns> ! string GetSubclassPropertyName( int i ); /// <summary> *************** *** 94,98 **** /// (optional operation) /// </summary> ! string[] GetSubclassPropertyColumnNames(int i); /// <summary> --- 92,96 ---- /// (optional operation) /// </summary> ! string[ ] GetSubclassPropertyColumnNames( int i ); /// <summary> *************** *** 101,105 **** /// (optional operation) /// </summary> ! string GetSubclassPropertyTableName(int i); /// <summary> --- 99,103 ---- /// (optional operation) /// </summary> ! string GetSubclassPropertyTableName( int i ); /// <summary> *************** *** 110,115 **** /// <param name="i"></param> /// <returns></returns> ! string[] ToColumns(string name, int i); ! /// <summary> /// Given a query alias and an identifying suffix, render the identifier select fragment --- 108,113 ---- /// <param name="i"></param> /// <returns></returns> ! string[ ] ToColumns( string name, int i ); ! /// <summary> /// Given a query alias and an identifying suffix, render the identifier select fragment *************** *** 118,122 **** /// <param name="suffix"></param> /// <returns></returns> ! SqlString IdentifierSelectFragment(string name, string suffix); /// <summary> --- 116,120 ---- /// <param name="suffix"></param> /// <returns></returns> ! SqlString IdentifierSelectFragment( string name, string suffix ); /// <summary> *************** *** 127,131 **** /// <param name="suffix"></param> /// <returns></returns> ! SqlString PropertySelectFragment(string alias, string suffix); /// <summary> --- 125,129 ---- /// <param name="suffix"></param> /// <returns></returns> ! SqlString PropertySelectFragment( string alias, string suffix ); /// <summary> *************** *** 134,139 **** /// <param name="alias"></param> /// <returns></returns> ! SqlString FromTableFragment(string alias); ! /// <summary> /// Get the where clause part of any joins (optional operation) --- 132,137 ---- /// <param name="alias"></param> /// <returns></returns> ! SqlString FromTableFragment( string alias ); ! /// <summary> /// Get the where clause part of any joins (optional operation) *************** *** 143,147 **** /// <param name="includeSubclasses"></param> /// <returns></returns> ! SqlString WhereJoinFragment(string alias, bool innerJoin, bool includeSubclasses); /// <summary> --- 141,145 ---- /// <param name="includeSubclasses"></param> /// <returns></returns> ! SqlString WhereJoinFragment( string alias, bool innerJoin, bool includeSubclasses ); /// <summary> *************** *** 152,157 **** /// <param name="includeSubclasses"></param> /// <returns></returns> ! SqlString FromJoinFragment(string alias, bool innerJoin, bool includeSubclasses); } ! } --- 150,155 ---- /// <param name="includeSubclasses"></param> /// <returns></returns> ! SqlString FromJoinFragment( string alias, bool innerJoin, bool includeSubclasses ); } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 21:49:32
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3481 Modified Files: AbstractEntityPersister.cs EntityPersister.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: AbstractEntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/AbstractEntityPersister.cs,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** AbstractEntityPersister.cs 9 Dec 2004 17:52:15 -0000 1.29 --- AbstractEntityPersister.cs 31 Dec 2004 21:49:23 -0000 1.30 *************** *** 2,17 **** using System.Collections; using System.Reflection; - using Iesi.Collections; ! using NHibernate.Cache; - using NHibernate.Cfg; - using NHibernate.Dialect; using NHibernate.Engine; - using NHibernate.Hql; [...1981 lines suppressed...] ! /// <param name="i"></param> ! /// <returns></returns> ! public abstract string[ ] GetSubclassPropertyColumnNames( int i ); ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="i"></param> ! /// <returns></returns> ! public abstract string GetSubclassPropertyTableName( int i ); ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="i"></param> ! /// <returns></returns> ! public abstract string GetSubclassPropertyName( int i ); } ! } \ No newline at end of file Index: EntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/EntityPersister.cs,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** EntityPersister.cs 4 Dec 2004 22:41:29 -0000 1.33 --- EntityPersister.cs 31 Dec 2004 21:49:23 -0000 1.34 *************** *** 2,9 **** using System.Collections; using System.Data; - using System.Text; - using Iesi.Collections; ! using NHibernate.Engine; using NHibernate.Hql; --- 2,7 ---- using System.Collections; [...2390 lines suppressed...] ! /// <param name="alias"></param> ! /// <param name="innerJoin"></param> ! /// <param name="includeSubclasses"></param> ! /// <returns></returns> ! public override SqlString WhereJoinFragment( string alias, bool innerJoin, bool includeSubclasses ) { return new SqlString( String.Empty ); *************** *** 1230,1234 **** - } ! } --- 1412,1415 ---- } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 21:49:20
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Metadata In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3390 Modified Files: IClassMetadata.cs ICollectionMetadata.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: IClassMetadata.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Metadata/IClassMetadata.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** IClassMetadata.cs 3 Sep 2004 19:02:11 -0000 1.5 --- IClassMetadata.cs 31 Dec 2004 21:48:54 -0000 1.6 *************** *** 1,13 **** - using System; using NHibernate.Type; ! namespace NHibernate.Metadata { /// <summary> /// Exposes entity class metadata to the application /// </summary> ! public interface IClassMetadata { - /// <summary> /// The persistent class --- 1,11 ---- using NHibernate.Type; ! namespace NHibernate.Metadata { /// <summary> /// Exposes entity class metadata to the application /// </summary> ! public interface IClassMetadata { /// <summary> /// The persistent class *************** *** 23,27 **** /// The names of the class' persistent properties /// </summary> ! string[] PropertyNames { get; } /// <summary> --- 21,25 ---- /// The names of the class' persistent properties /// </summary> ! string[ ] PropertyNames { get; } /// <summary> *************** *** 33,60 **** /// The Hibernate types of the classes properties /// </summary> ! IType[] PropertyTypes { get; } /// <summary> /// Get the value of a particular (named) property /// </summary> ! /// <param name="?"></param> /// <returns></returns> ! object GetPropertyValue(object obj, string propertyName); ! /// <summary> /// Set the value of a particular (named) property /// </summary> ! /// <param name="?"></param> ! void SetPropertyValue(object obj, string propertyName, object value); ! /// <summary> /// Return the values of the mapped properties of the object /// </summary> ! object[] GetPropertyValues(object entity); /// <summary> /// Set the given values to the mapped properties of the given object /// </summary> ! void SetPropertyValues(object entity, object[] values); /// <summary> --- 31,64 ---- /// The Hibernate types of the classes properties /// </summary> ! IType[ ] PropertyTypes { get; } /// <summary> /// Get the value of a particular (named) property /// </summary> ! /// <param name="obj"></param> ! /// <param name="propertyName"></param> /// <returns></returns> ! object GetPropertyValue( object obj, string propertyName ); ! /// <summary> /// Set the value of a particular (named) property /// </summary> ! /// <param name="obj"></param> ! /// <param name="propertyName"></param> ! /// <param name="value"></param> ! void SetPropertyValue( object obj, string propertyName, object value ); ! /// <summary> /// Return the values of the mapped properties of the object /// </summary> ! /// <param name="entity"></param> ! object[ ] GetPropertyValues( object entity ); /// <summary> /// Set the given values to the mapped properties of the given object /// </summary> ! /// <param name="entity"></param> ! /// <param name="values"></param> ! void SetPropertyValues( object entity, object[ ] values ); /// <summary> *************** *** 63,67 **** /// <param name="entity"></param> /// <returns></returns> ! object GetIdentifier(object entity); /// <summary> --- 67,71 ---- /// <param name="entity"></param> /// <returns></returns> ! object GetIdentifier( object entity ); /// <summary> *************** *** 70,74 **** /// <param name="entity"></param> /// <param name="id"></param> ! void SetIdentifier(object entity, object id); /// <summary> --- 74,78 ---- /// <param name="entity"></param> /// <param name="id"></param> ! void SetIdentifier( object entity, object id ); /// <summary> *************** *** 103,107 **** /// <param name="obj"></param> /// <returns></returns> ! object GetVersion(object obj); /// <summary> --- 107,111 ---- /// <param name="obj"></param> /// <returns></returns> ! object GetVersion( object obj ); /// <summary> *************** *** 111,113 **** } ! } --- 115,117 ---- } ! } \ No newline at end of file Index: ICollectionMetadata.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Metadata/ICollectionMetadata.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ICollectionMetadata.cs 30 Mar 2004 14:19:35 -0000 1.2 --- ICollectionMetadata.cs 31 Dec 2004 21:48:54 -0000 1.3 *************** *** 1,13 **** - using System; using NHibernate.Type; ! namespace NHibernate.Metadata { /// <summary> /// Exposes collection metadata to the application /// </summary> ! public interface ICollectionMetadata { - /// <summary> /// The collection key type --- 1,11 ---- using NHibernate.Type; ! namespace NHibernate.Metadata { /// <summary> /// Exposes collection metadata to the application /// </summary> ! public interface ICollectionMetadata { /// <summary> /// The collection key type *************** *** 50,52 **** bool IsLazy { get; } } ! } --- 48,50 ---- bool IsLazy { get; } } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 21:28:37
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32268 Modified Files: Table.cs UniqueKey.cs Value.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: Value.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Value.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Value.cs 13 Apr 2004 02:06:54 -0000 1.9 --- Value.cs 31 Dec 2004 21:28:13 -0000 1.10 *************** *** 1,5 **** using System; using System.Collections; - using NHibernate.Dialect; using NHibernate.Id; using NHibernate.Loader; --- 1,4 ---- *************** *** 7,11 **** using NHibernate.Util; ! namespace NHibernate.Mapping { /// <summary> --- 6,10 ---- using NHibernate.Util; ! namespace NHibernate.Mapping { /// <summary> *************** *** 14,18 **** /// of this class /// </summary> ! public class Value { private ArrayList columns = new ArrayList(); --- 13,17 ---- /// of this class /// </summary> ! public class Value { private ArrayList columns = new ArrayList(); *************** *** 24,59 **** private Formula formula; ! public Value(Table table) { this.table = table; } ! public virtual void AddColumn(Column column) { ! if ( !columns.Contains(column) ) columns.Add(column); } ! public virtual int ColumnSpan { get { return columns.Count; } } ! public virtual ICollection ColumnCollection { get { return columns; } } ! public virtual IList ConstraintColumns { get { return columns; } } ! public virtual IType Type { get { return type; } ! set { this.type = value; int count = 0; ! ! foreach(Column col in ColumnCollection) { col.Type = type; --- 23,75 ---- private Formula formula; ! /// <summary> ! /// ! /// </summary> ! /// <param name="table"></param> ! public Value( Table table ) { this.table = table; } ! /// <summary> ! /// ! /// </summary> ! /// <param name="column"></param> ! public virtual void AddColumn( Column column ) { ! if( !columns.Contains( column ) ) ! { ! columns.Add( column ); ! } } ! ! /// <summary></summary> ! public virtual int ColumnSpan { get { return columns.Count; } } ! ! /// <summary></summary> ! public virtual ICollection ColumnCollection { get { return columns; } } ! /// <summary></summary> ! public virtual IList ConstraintColumns { get { return columns; } } ! /// <summary></summary> ! public virtual IType Type { get { return type; } ! set { this.type = value; int count = 0; ! ! foreach( Column col in ColumnCollection ) { col.Type = type; *************** *** 63,67 **** } ! public Table Table { get { return table; } --- 79,84 ---- } ! /// <summary></summary> ! public Table Table { get { return table; } *************** *** 69,77 **** } ! public virtual void CreateForeignKey() { } ! public void CreateForeignKeyOfClass(System.Type persistentClass) { ForeignKey fk = table.CreateForeignKey( ConstraintColumns ); --- 86,99 ---- } ! /// <summary></summary> ! public virtual void CreateForeignKey() { } ! /// <summary> ! /// ! /// </summary> ! /// <param name="persistentClass"></param> ! public void CreateForeignKeyOfClass( System.Type persistentClass ) { ForeignKey fk = table.CreateForeignKey( ConstraintColumns ); *************** *** 81,89 **** private IIdentifierGenerator uniqueIdentifierGenerator; ! public IIdentifierGenerator CreateIdentifierGenerator(Dialect.Dialect dialect) { ! if ( uniqueIdentifierGenerator==null ) { ! uniqueIdentifierGenerator = IdentifierGeneratorFactory.Create(identifierGeneratorStrategy, type, identifierGeneratorProperties, dialect); } --- 103,116 ---- private IIdentifierGenerator uniqueIdentifierGenerator; ! /// <summary> ! /// ! /// </summary> ! /// <param name="dialect"></param> ! /// <returns></returns> ! public IIdentifierGenerator CreateIdentifierGenerator( Dialect.Dialect dialect ) { ! if( uniqueIdentifierGenerator == null ) { ! uniqueIdentifierGenerator = IdentifierGeneratorFactory.Create( identifierGeneratorStrategy, type, identifierGeneratorProperties, dialect ); } *************** *** 91,103 **** } ! public virtual void SetTypeByReflection(System.Type propertyClass, string propertyName) { ! try { ! if (type==null) { ! type = ReflectHelper.ReflectedPropertyType(propertyClass, propertyName); int count = 0; ! foreach(Column col in ColumnCollection) { col.Type = type; --- 118,135 ---- } ! /// <summary> ! /// ! /// </summary> ! /// <param name="propertyClass"></param> ! /// <param name="propertyName"></param> ! public virtual void SetTypeByReflection( System.Type propertyClass, string propertyName ) { ! try { ! if( type == null ) { ! type = ReflectHelper.ReflectedPropertyType( propertyClass, propertyName ); int count = 0; ! foreach( Column col in ColumnCollection ) { col.Type = type; *************** *** 105,122 **** } } ! } ! catch (HibernateException he) { ! throw new MappingException("Problem trying to set property type by reflection", he); } } ! public virtual OuterJoinLoaderType OuterJoinFetchSetting { ! get { return OuterJoinLoaderType.Lazy; } set { throw new NotSupportedException(); } } ! public IDictionary IdentifierGeneratorProperties { get { return identifierGeneratorProperties; } --- 137,156 ---- } } ! } ! catch( HibernateException he ) { ! throw new MappingException( "Problem trying to set property type by reflection", he ); } } ! /// <summary></summary> ! public virtual OuterJoinLoaderType OuterJoinFetchSetting { ! get { return OuterJoinLoaderType.Lazy; } set { throw new NotSupportedException(); } } ! /// <summary></summary> ! public IDictionary IdentifierGeneratorProperties { get { return identifierGeneratorProperties; } *************** *** 124,139 **** } ! public string IdentifierGeneratorStrategy { get { return identifierGeneratorStrategy; } set { identifierGeneratorStrategy = value; } } ! ! ! public virtual bool IsComposite { get { return false; } } ! public string NullValue { get { return nullValue; } --- 158,176 ---- } ! /// <summary></summary> ! public string IdentifierGeneratorStrategy ! { get { return identifierGeneratorStrategy; } set { identifierGeneratorStrategy = value; } } ! /// <summary></summary> ! public virtual bool IsComposite ! { get { return false; } } ! /// <summary></summary> ! public string NullValue { get { return nullValue; } *************** *** 141,151 **** } ! public virtual bool IsAny { get { return false; } ! } ! ! ! public Formula Formula { get { return formula; } --- 178,189 ---- } ! /// <summary></summary> ! public virtual bool IsAny { get { return false; } ! } ! ! /// <summary></summary> ! public Formula Formula { get { return formula; } *************** *** 153,155 **** } } ! } --- 191,193 ---- } } ! } \ No newline at end of file Index: Table.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Table.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Table.cs 16 Apr 2004 04:13:22 -0000 1.13 --- Table.cs 31 Dec 2004 21:28:13 -0000 1.14 *************** *** 1,18 **** - using System; - using System.Text; - using System.Data; using System.Collections; ! using NHibernate.Util; ! using NHibernate.Dialect; ! using NHibernate.Id; using NHibernate.Engine; ! namespace NHibernate.Mapping { /// <summary> /// Represents a Table in a database that an object gets mapped against. /// </summary> ! public class Table : IRelationalModel ! { private string name; private string schema; --- 1,16 ---- using System.Collections; ! using System.Data; ! using System.Text; using NHibernate.Engine; + using NHibernate.Id; + using NHibernate.Util; ! namespace NHibernate.Mapping { /// <summary> /// Represents a Table in a database that an object gets mapped against. /// </summary> ! public class Table : IRelationalModel ! { private string name; private string schema; *************** *** 27,145 **** private static int tableCounter = 0; ! public Table() { uniqueInteger = tableCounter++; } ! public string GetQualifiedName(Dialect.Dialect dialect) { ! string quotedName = GetQuotedName(dialect); ! return schema==null ? quotedName : schema + StringHelper.Dot + quotedName; } ! /// <summary> /// Returns the QualifiedName for the table using the specified Qualifier /// </summary> /// <param name="defaultQualifier">The Qualifier to use when accessing the table.</param> /// <returns>A String representing the Qualified name.</returns> /// <remarks>If this were used with MSSQL it would return a dbo.table_name.</remarks> ! public string GetQualifiedName(Dialect.Dialect dialect, string defaultQualifier) { ! string quotedName = GetQuotedName(dialect); ! return schema==null ? ! ( (defaultQualifier==null) ? quotedName : defaultQualifier + StringHelper.Dot + quotedName ) : ! GetQualifiedName(dialect); } ! public string Name { get { return name; } ! set ! { ! if (value[0]=='`') { quoted = true; ! name = value.Substring(1, value.Length-2); } ! else { ! name = value; } } } ! public string GetQuotedName(Dialect.Dialect dialect) { return IsQuoted ? ! dialect.QuoteForTableName(name): name; } ! public Column GetColumn(int n) { IEnumerator iter = columns.Values.GetEnumerator(); ! for (int i=0; i<n; i++) iter.MoveNext(); ! return (Column) iter.Current; } ! ! public void AddColumn(Column column) { ! Column old = (Column) columns[ column.Name ]; ! if (old == null) { ! columns[column.Name] = column; column.uniqueInteger = columns.Count; ! } ! else { column.uniqueInteger = old.uniqueInteger; } } ! public int ColumnSpan { get { return columns.Count; } } ! public ICollection ColumnCollection { get { return columns.Values; } } public ICollection IndexCollection { get { return indexes.Values; } } ! public ICollection ForeignKeyCollection { get { return foreignKeys.Values; } } ! public ICollection UniqueKeyCollection { get { return uniqueKeys.Values; } } ! public IList SqlAlterStrings(Dialect.Dialect dialect, IMapping p, DataTable tableInfo) { ! StringBuilder root = new StringBuilder("alter table ") ! .Append( GetQualifiedName(dialect) ) ! .Append(" ") .Append( dialect.AddColumnString ); ! IList results = new ArrayList(ColumnCollection.Count); ! foreach(Column col in ColumnCollection) { DataColumn columnInfo = tableInfo.Columns[ col.Name ]; ! if (columnInfo == null) { StringBuilder alter = new StringBuilder( root.ToString() ) ! .Append(" ") ! .Append( col.GetQuotedName(dialect) ) ! .Append(" ") ! .Append(col.GetSqlType(dialect, p)); ! if (col.IsUnique && dialect.SupportsUnique) { ! alter.Append(" unique"); } --- 25,185 ---- private static int tableCounter = 0; ! /// <summary></summary> ! public Table() { uniqueInteger = tableCounter++; } ! /// <summary> ! /// ! /// </summary> ! /// <param name="dialect"></param> ! /// <returns></returns> ! public string GetQualifiedName( Dialect.Dialect dialect ) { ! string quotedName = GetQuotedName( dialect ); ! return schema == null ? quotedName : schema + StringHelper.Dot + quotedName; } ! /// <summary> /// Returns the QualifiedName for the table using the specified Qualifier /// </summary> + /// <param name="dialect"></param> /// <param name="defaultQualifier">The Qualifier to use when accessing the table.</param> /// <returns>A String representing the Qualified name.</returns> /// <remarks>If this were used with MSSQL it would return a dbo.table_name.</remarks> ! public string GetQualifiedName( Dialect.Dialect dialect, string defaultQualifier ) { ! string quotedName = GetQuotedName( dialect ); ! return schema == null ? ! ( ( defaultQualifier == null ) ? quotedName : defaultQualifier + StringHelper.Dot + quotedName ) : ! GetQualifiedName( dialect ); } ! /// <summary></summary> ! public string Name { get { return name; } ! set ! { ! if( value[ 0 ] == '`' ) { quoted = true; ! name = value.Substring( 1, value.Length - 2 ); } ! else { ! name = value; } } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="dialect"></param> ! /// <returns></returns> ! public string GetQuotedName( Dialect.Dialect dialect ) { return IsQuoted ? ! dialect.QuoteForTableName( name ) : name; } ! /// <summary> ! /// ! /// </summary> ! /// <param name="n"></param> ! /// <returns></returns> ! public Column GetColumn( int n ) { IEnumerator iter = columns.Values.GetEnumerator(); ! for( int i = 0; i < n; i++ ) ! { ! iter.MoveNext(); ! } ! return ( Column ) iter.Current; } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="column"></param> ! public void AddColumn( Column column ) { ! Column old = ( Column ) columns[ column.Name ]; ! if( old == null ) { ! columns[ column.Name ] = column; column.uniqueInteger = columns.Count; ! } ! else { column.uniqueInteger = old.uniqueInteger; } } ! ! /// <summary></summary> ! public int ColumnSpan { get { return columns.Count; } } ! ! /// <summary></summary> ! public ICollection ColumnCollection { get { return columns.Values; } } + + /// <summary></summary> public ICollection IndexCollection { get { return indexes.Values; } } ! ! /// <summary></summary> ! public ICollection ForeignKeyCollection { get { return foreignKeys.Values; } } ! ! /// <summary></summary> ! public ICollection UniqueKeyCollection { get { return uniqueKeys.Values; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="dialect"></param> ! /// <param name="p"></param> ! /// <param name="tableInfo"></param> ! /// <returns></returns> ! public IList SqlAlterStrings( Dialect.Dialect dialect, IMapping p, DataTable tableInfo ) { ! StringBuilder root = new StringBuilder( "alter table " ) ! .Append( GetQualifiedName( dialect ) ) ! .Append( " " ) .Append( dialect.AddColumnString ); ! IList results = new ArrayList( ColumnCollection.Count ); ! foreach( Column col in ColumnCollection ) { DataColumn columnInfo = tableInfo.Columns[ col.Name ]; ! if( columnInfo == null ) { StringBuilder alter = new StringBuilder( root.ToString() ) ! .Append( " " ) ! .Append( col.GetQuotedName( dialect ) ) ! .Append( " " ) ! .Append( col.GetSqlType( dialect, p ) ); ! if( col.IsUnique && dialect.SupportsUnique ) { ! alter.Append( " unique" ); } *************** *** 151,213 **** } ! public string SqlCreateString(Dialect.Dialect dialect, IMapping p) { ! StringBuilder buf = new StringBuilder("create table ") ! .Append( GetQualifiedName(dialect) ) ! .Append( " ("); ! bool identityColumn = idValue!=null && idValue.CreateIdentifierGenerator(dialect) is IdentityGenerator; // try to find out the name of the pk to create it as identity if the identitygenerator is used string pkname = null; ! if (primaryKey != null && identityColumn ) { ! foreach(Column col in primaryKey.ColumnCollection) { ! pkname = col.GetQuotedName(dialect); //should only go through this loop once } } int i = 0; ! foreach(Column col in ColumnCollection) { i++; ! buf.Append( col.GetQuotedName(dialect) ) ! .Append(' ') ! .Append( col.GetSqlType(dialect, p) ); ! if ( identityColumn && col.GetQuotedName(dialect).Equals(pkname) ) { ! buf.Append(' ') ! .Append( dialect.IdentityColumnString); ! } ! else { ! if (col.IsNullable) { buf.Append( dialect.NullColumnString ); ! } ! else { ! buf.Append(" not null" ); } } ! if ( col.IsUnique) { ! if(dialect.SupportsUnique) { ! buf.Append(" unique"); } ! else { ! UniqueKey uk = GetUniqueKey(col.GetQuotedName(dialect) + "_"); ! uk.AddColumn(col); } } ! if ( i < ColumnCollection.Count ) buf.Append(StringHelper.CommaSpace); } ! if (primaryKey != null) { //if ( dialect is HSQLDialect && identityColumn ) { --- 191,262 ---- } ! /// <summary> ! /// ! /// </summary> ! /// <param name="dialect"></param> ! /// <param name="p"></param> ! /// <returns></returns> ! public string SqlCreateString( Dialect.Dialect dialect, IMapping p ) { ! StringBuilder buf = new StringBuilder( "create table " ) ! .Append( GetQualifiedName( dialect ) ) ! .Append( " (" ); ! bool identityColumn = idValue != null && idValue.CreateIdentifierGenerator( dialect ) is IdentityGenerator; // try to find out the name of the pk to create it as identity if the identitygenerator is used string pkname = null; ! if( primaryKey != null && identityColumn ) { ! foreach( Column col in primaryKey.ColumnCollection ) { ! pkname = col.GetQuotedName( dialect ); //should only go through this loop once } } int i = 0; ! foreach( Column col in ColumnCollection ) { i++; ! buf.Append( col.GetQuotedName( dialect ) ) ! .Append( ' ' ) ! .Append( col.GetSqlType( dialect, p ) ); ! if( identityColumn && col.GetQuotedName( dialect ).Equals( pkname ) ) { ! buf.Append( ' ' ) ! .Append( dialect.IdentityColumnString ); ! } ! else { ! if( col.IsNullable ) { buf.Append( dialect.NullColumnString ); ! } ! else { ! buf.Append( " not null" ); } } ! if( col.IsUnique ) { ! if( dialect.SupportsUnique ) { ! buf.Append( " unique" ); } ! else { ! UniqueKey uk = GetUniqueKey( col.GetQuotedName( dialect ) + "_" ); ! uk.AddColumn( col ); } } ! if( i < ColumnCollection.Count ) ! { ! buf.Append( StringHelper.CommaSpace ); ! } } ! if( primaryKey != null ) { //if ( dialect is HSQLDialect && identityColumn ) { *************** *** 215,237 **** // //ugly hack... //} else { ! buf.Append(',').Append( primaryKey.SqlConstraintString(dialect) ); //} } ! ! foreach(UniqueKey uk in UniqueKeyCollection) { ! buf.Append(',').Append( uk.SqlConstraintString(dialect) ); } ! ! buf.Append(StringHelper.ClosedParen); return buf.ToString(); } ! public string SqlDropString(Dialect.Dialect dialect) { ! return "drop table " + GetQualifiedName(dialect) + dialect.CascadeConstraintsString; } ! public PrimaryKey PrimaryKey { get { return primaryKey; } --- 264,293 ---- // //ugly hack... //} else { ! buf.Append( ',' ).Append( primaryKey.SqlConstraintString( dialect ) ); //} } ! ! foreach( UniqueKey uk in UniqueKeyCollection ) { ! buf.Append( ',' ).Append( uk.SqlConstraintString( dialect ) ); } ! ! buf.Append( StringHelper.ClosedParen ); return buf.ToString(); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="dialect"></param> ! /// <returns></returns> ! public string SqlDropString( Dialect.Dialect dialect ) ! { ! return "drop table " + GetQualifiedName( dialect ) + dialect.CascadeConstraintsString; } ! /// <summary></summary> ! public PrimaryKey PrimaryKey { get { return primaryKey; } *************** *** 239,252 **** } ! public Index GetIndex(string name) { ! Index index = (Index) indexes[name]; ! if (index == null) { index = new Index(); index.Name = name; index.Table = this; ! indexes.Add(name, index); } --- 295,313 ---- } ! /// <summary> ! /// ! /// </summary> ! /// <param name="name"></param> ! /// <returns></returns> ! public Index GetIndex( string name ) { ! Index index = ( Index ) indexes[ name ]; ! if( index == null ) { index = new Index(); index.Name = name; index.Table = this; ! indexes.Add( name, index ); } *************** *** 254,266 **** } ! public UniqueKey GetUniqueKey(string name) { ! UniqueKey uk = (UniqueKey) uniqueKeys[name]; ! if (uk == null) { uk = new UniqueKey(); uk.Name = name; uk.Table = this; ! uniqueKeys.Add(name, uk); } --- 315,333 ---- } ! /// <summary> ! /// ! /// </summary> ! /// <param name="name"></param> ! /// <returns></returns> ! public UniqueKey GetUniqueKey( string name ) { ! UniqueKey uk = ( UniqueKey ) uniqueKeys[ name ]; ! if( uk == null ) ! { uk = new UniqueKey(); uk.Name = name; uk.Table = this; ! uniqueKeys.Add( name, uk ); } *************** *** 268,285 **** } ! 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); } ! foreach(Column col in columns) { fk.AddColumn( col ); --- 335,357 ---- } ! /// <summary> ! /// ! /// </summary> ! /// <param name="columns"></param> ! /// <returns></returns> ! 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 ); } ! foreach( Column col in columns ) { fk.AddColumn( col ); *************** *** 289,298 **** } ! public string UniqueColumnString(ICollection col) { - int result = 0; ! ! foreach(object obj in col) { // this is marked as unchecked because the GetHashCode could potentially --- 361,374 ---- } ! /// <summary> ! /// ! /// </summary> ! /// <param name="col"></param> ! /// <returns></returns> ! public string UniqueColumnString( ICollection col ) { int result = 0; ! ! foreach( object obj in col ) { // this is marked as unchecked because the GetHashCode could potentially *************** *** 300,310 **** // just roll back over - since we are not doing any computations based // on this number then a rollover is no big deal. ! unchecked{ result += obj.GetHashCode(); } } ! ! return ( name.GetHashCode().ToString("X") + result.GetHashCode().ToString("X") ); } ! public string Schema { get { return schema; } --- 376,390 ---- // just roll back over - since we are not doing any computations based // on this number then a rollover is no big deal. ! unchecked ! { ! result += obj.GetHashCode(); ! } } ! ! return ( name.GetHashCode().ToString( "X" ) + result.GetHashCode().ToString( "X" ) ); } ! /// <summary></summary> ! public string Schema { get { return schema; } *************** *** 312,332 **** } ! public int UniqueInteger { get { return uniqueInteger; } } ! public void SetIdentifierValue(Value idValue) { this.idValue = idValue; } ! public bool IsQuoted { get { return quoted; } set { quoted = value; } } ! } ! } --- 392,418 ---- } ! /// <summary></summary> ! public int UniqueInteger { get { return uniqueInteger; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="idValue"></param> ! public void SetIdentifierValue( Value idValue ) { this.idValue = idValue; } ! /// <summary></summary> ! public bool IsQuoted { get { return quoted; } set { quoted = value; } } ! } ! } \ No newline at end of file Index: UniqueKey.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/UniqueKey.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UniqueKey.cs 13 Apr 2004 02:06:54 -0000 1.4 --- UniqueKey.cs 31 Dec 2004 21:28:13 -0000 1.5 *************** *** 1,49 **** - using System; - using System.Collections; using System.Text; - - using NHibernate.Dialect; using NHibernate.Util; ! namespace NHibernate.Mapping ! { ! public class UniqueKey : Constraint { ! public string SqlConstraintString(Dialect.Dialect d) { ! StringBuilder buf = new StringBuilder(" unique ("); bool commaNeeded = false; ! ! foreach(Column col in ColumnCollection) { ! if(commaNeeded) buf.Append( StringHelper.CommaSpace ); commaNeeded = true; ! ! buf.Append( col.GetQuotedName(d) ); ! } ! ! return buf.Append(StringHelper.ClosedParen).ToString(); } ! public override string SqlConstraintString(Dialect.Dialect d, string constraintName) { StringBuilder buf = new StringBuilder( ! d.GetAddPrimaryKeyConstraintString(constraintName)) ! .Append('('); ! bool commaNeeded = false; ! foreach(Column col in ColumnCollection) { ! if(commaNeeded) buf.Append( StringHelper.CommaSpace ); commaNeeded = true; ! ! buf.Append( col.GetQuotedName(d) ); ! } ! ! return StringHelper.Replace( buf.Append(StringHelper.ClosedParen).ToString(), "primary key", "unique" ); } } ! } --- 1,63 ---- using System.Text; using NHibernate.Util; ! namespace NHibernate.Mapping ! { ! /// <summary></summary> ! public class UniqueKey : Constraint { ! /// <summary> ! /// ! /// </summary> ! /// <param name="d"></param> ! /// <returns></returns> ! public string SqlConstraintString( Dialect.Dialect d ) { ! StringBuilder buf = new StringBuilder( " unique (" ); bool commaNeeded = false; ! ! foreach( Column col in ColumnCollection ) { ! if( commaNeeded ) ! { ! buf.Append( StringHelper.CommaSpace ); ! } commaNeeded = true; ! ! buf.Append( col.GetQuotedName( d ) ); ! } ! ! return buf.Append( StringHelper.ClosedParen ).ToString(); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="d"></param> ! /// <param name="constraintName"></param> ! /// <returns></returns> ! public override string SqlConstraintString( Dialect.Dialect d, string constraintName ) { StringBuilder buf = new StringBuilder( ! d.GetAddPrimaryKeyConstraintString( constraintName ) ) ! .Append( '(' ); ! bool commaNeeded = false; ! foreach( Column col in ColumnCollection ) { ! if( commaNeeded ) ! { ! buf.Append( StringHelper.CommaSpace ); ! } commaNeeded = true; ! ! buf.Append( col.GetQuotedName( d ) ); ! } ! ! return StringHelper.Replace( buf.Append( StringHelper.ClosedParen ).ToString(), "primary key", "unique" ); } } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 21:28:07
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32146 Modified Files: Property.cs RootClass.cs Set.cs Subclass.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: Property.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Property.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Property.cs 10 Sep 2004 21:23:15 -0000 1.9 --- Property.cs 31 Dec 2004 21:27:54 -0000 1.10 *************** *** 1,12 **** - using System; using System.Collections; - using NHibernate.Engine; - using NHibernate.Type; using NHibernate.Property; ! namespace NHibernate.Mapping { ! public class Property { private string name; --- 1,11 ---- using System.Collections; using NHibernate.Engine; using NHibernate.Property; + using NHibernate.Type; ! namespace NHibernate.Mapping { ! /// <summary></summary> ! public class Property { private string name; *************** *** 17,26 **** private string propertyAccessorName; ! public Property(Value propertyValue) { this.propertyValue = propertyValue; } ! public IType Type { get { return propertyValue.Type; } --- 16,30 ---- private string propertyAccessorName; ! /// <summary> ! /// ! /// </summary> ! /// <param name="propertyValue"></param> ! public Property( Value propertyValue ) { this.propertyValue = propertyValue; } ! /// <summary></summary> ! public IType Type { get { return propertyValue.Type; } *************** *** 30,34 **** /// Gets the number of columns this property uses in the db. /// </summary> ! public int ColumnSpan { get { return propertyValue.ColumnSpan; } --- 34,38 ---- /// Gets the number of columns this property uses in the db. /// </summary> ! public int ColumnSpan { get { return propertyValue.ColumnSpan; } *************** *** 38,42 **** /// Gets an <see cref="ICollection"/> of <see cref="Column"/>s. /// </summary> ! public ICollection ColumnCollection { get { return propertyValue.ColumnCollection; } --- 42,46 ---- /// Gets an <see cref="ICollection"/> of <see cref="Column"/>s. /// </summary> ! public ICollection ColumnCollection { get { return propertyValue.ColumnCollection; } *************** *** 46,50 **** /// Gets or Sets the name of the Property in the class. /// </summary> ! public string Name { get { return name; } --- 50,54 ---- /// Gets or Sets the name of the Property in the class. /// </summary> ! public string Name { get { return name; } *************** *** 52,67 **** } ! public bool IsUpdateable { ! get { return updateable && !IsFormula ; } set { updateable = value; } } ! public bool IsComposite { get { return propertyValue is Component; } } ! public Value Value { get { return propertyValue; } --- 56,74 ---- } ! /// <summary></summary> ! public bool IsUpdateable { ! get { return updateable && !IsFormula; } set { updateable = value; } } ! /// <summary></summary> ! public bool IsComposite { get { return propertyValue is Component; } } ! /// <summary></summary> ! public Value Value { get { return propertyValue; } *************** *** 69,112 **** } ! public Cascades.CascadeStyle CascadeStyle { ! get { IType type = propertyValue.Type; ! if (type.IsComponentType && !type.IsObjectType) { ! IAbstractComponentType actype = (IAbstractComponentType) propertyValue.Type; int length = actype.Subtypes.Length; ! for (int i=0; i<length; i++) { ! if ( actype.Cascade(i)!= Cascades.CascadeStyle.StyleNone ) return Cascades.CascadeStyle.StyleAll; } return Cascades.CascadeStyle.StyleNone; ! } ! else { ! if (cascade.Equals("all")) { return Cascades.CascadeStyle.StyleAll; ! } ! else if (cascade.Equals("all-delete-orphan") ) { return Cascades.CascadeStyle.StyleAllGC; } ! else if (cascade.Equals("none")) { return Cascades.CascadeStyle.StyleNone; ! } ! else if (cascade.Equals("save-update")) { return Cascades.CascadeStyle.StyleSaveUpdate; ! } ! else if (cascade.Equals("delete")) { return Cascades.CascadeStyle.StyleOnlyDelete; ! } ! else { ! throw new MappingException("Unspported cascade style: " + cascade); } } --- 76,124 ---- } ! /// <summary></summary> ! public Cascades.CascadeStyle CascadeStyle { ! get ! { IType type = propertyValue.Type; ! if( type.IsComponentType && !type.IsObjectType ) { ! IAbstractComponentType actype = ( IAbstractComponentType ) propertyValue.Type; int length = actype.Subtypes.Length; ! for( int i = 0; i < length; i++ ) { ! if( actype.Cascade( i ) != Cascades.CascadeStyle.StyleNone ) ! { ! return Cascades.CascadeStyle.StyleAll; ! } } return Cascades.CascadeStyle.StyleNone; ! } ! else { ! if( cascade.Equals( "all" ) ) { return Cascades.CascadeStyle.StyleAll; ! } ! else if( cascade.Equals( "all-delete-orphan" ) ) { return Cascades.CascadeStyle.StyleAllGC; } ! else if( cascade.Equals( "none" ) ) { return Cascades.CascadeStyle.StyleNone; ! } ! else if( cascade.Equals( "save-update" ) ) { return Cascades.CascadeStyle.StyleSaveUpdate; ! } ! else if( cascade.Equals( "delete" ) ) { return Cascades.CascadeStyle.StyleOnlyDelete; ! } ! else { ! throw new MappingException( "Unspported cascade style: " + cascade ); } } *************** *** 114,118 **** } ! public string Cascade { get { return cascade; } --- 126,131 ---- } ! /// <summary></summary> ! public string Cascade { get { return cascade; } *************** *** 120,139 **** } ! public bool IsInsertable { get { return insertable && !IsFormula; } set { insertable = value; } } ! public Formula Formula { get { return propertyValue.Formula; } } ! public bool IsFormula { ! get { return Formula!=null; } } ! public string PropertyAccessorName { get { return propertyAccessorName; } --- 133,157 ---- } ! /// <summary></summary> ! public bool IsInsertable ! { get { return insertable && !IsFormula; } set { insertable = value; } } ! /// <summary></summary> ! public Formula Formula { get { return propertyValue.Formula; } } ! /// <summary></summary> ! public bool IsFormula { ! get { return Formula != null; } } ! /// <summary></summary> ! public string PropertyAccessorName { get { return propertyAccessorName; } *************** *** 141,162 **** } ! public IGetter GetGetter(System.Type clazz) { ! return PropertyAccessor.GetGetter(clazz, name); } ! public ISetter GetSetter(System.Type clazz) { ! return PropertyAccessor.GetSetter(clazz, name); } ! protected IPropertyAccessor PropertyAccessor { get { return PropertyAccessorFactory.GetPropertyAccessor( PropertyAccessorName ); } } ! public bool IsBasicPropertyAccessor { ! get { return propertyAccessorName==null || propertyAccessorName.Equals("property"); } } } --- 159,192 ---- } ! /// <summary> ! /// ! /// </summary> ! /// <param name="clazz"></param> ! /// <returns></returns> ! public IGetter GetGetter( System.Type clazz ) { ! return PropertyAccessor.GetGetter( clazz, name ); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="clazz"></param> ! /// <returns></returns> ! public ISetter GetSetter( System.Type clazz ) { ! return PropertyAccessor.GetSetter( clazz, name ); } ! /// <summary></summary> ! protected IPropertyAccessor PropertyAccessor { get { return PropertyAccessorFactory.GetPropertyAccessor( PropertyAccessorName ); } } ! /// <summary></summary> ! public bool IsBasicPropertyAccessor { ! get { return propertyAccessorName == null || propertyAccessorName.Equals( "property" ); } } } Index: RootClass.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/RootClass.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** RootClass.cs 10 Sep 2004 21:23:15 -0000 1.10 --- RootClass.cs 31 Dec 2004 21:27:54 -0000 1.11 *************** *** 1,8 **** using System; using System.Collections; using NHibernate.Cache; ! namespace NHibernate.Mapping ! { /// <summary> /// Declaration of a System.Type by using the <c><class></c> element. --- 1,10 ---- using System; using System.Collections; + using log4net; using NHibernate.Cache; + using NHibernate.Persister; ! namespace NHibernate.Mapping ! { /// <summary> /// Declaration of a System.Type by using the <c><class></c> element. *************** *** 79,91 **** /// <item> /// <term>persister</term> ! /// <description>(optional) Specifies a custom <see cref="Persister.IClassPersister"/>.</description> /// </item> /// </list> /// </remarks> ! public class RootClass : PersistentClass { ! private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(RootClass)); ! public const string DefaultIdentifierColumnName = "id"; public const string DefaultDiscriminatorColumnName = "class"; --- 81,95 ---- /// <item> /// <term>persister</term> ! /// <description>(optional) Specifies a custom <see cref="IClassPersister"/>.</description> /// </item> /// </list> /// </remarks> ! public class RootClass : PersistentClass { ! private static readonly ILog log = LogManager.GetLogger( typeof( RootClass ) ); ! ! /// <summary></summary> public const string DefaultIdentifierColumnName = "id"; + /// <summary></summary> public const string DefaultDiscriminatorColumnName = "class"; *************** *** 103,115 **** private string where; public bool Polymorphic { ! set ! { ! polymorphic = value; ! } } ! public override Property IdentifierProperty { get { return identifierProperty; } --- 107,118 ---- private string where; + /// <summary></summary> public bool Polymorphic { ! set { polymorphic = value; } } ! /// <summary></summary> ! public override Property IdentifierProperty { get { return identifierProperty; } *************** *** 117,121 **** } ! public override Value Identifier { get { return identifier; } --- 120,125 ---- } ! /// <summary></summary> ! public override Value Identifier { get { return identifier; } *************** *** 123,132 **** } ! public override bool HasIdentifierProperty { get { return identifierProperty != null; } } ! public override Value Discriminator { get { return discriminator; } --- 127,138 ---- } ! /// <summary></summary> ! public override bool HasIdentifierProperty { get { return identifierProperty != null; } } ! /// <summary></summary> ! public override Value Discriminator { get { return discriminator; } *************** *** 134,142 **** } ! public override bool IsInherited { get { return false; } } ! /// <summary> /// Indicates if the object has subclasses --- 140,149 ---- } ! /// <summary></summary> ! public override bool IsInherited { get { return false; } } ! /// <summary> /// Indicates if the object has subclasses *************** *** 146,164 **** /// through any other method - so no setter is declared for this property. /// </remarks> ! public override bool IsPolymorphic { get { return polymorphic; } } ! public override RootClass RootClazz { get { return this; } } ! public override ICollection PropertyClosureCollection { get { return PropertyCollection; } } ! /// <summary> /// Returns all of the Tables the Root class covers. --- 153,173 ---- /// through any other method - so no setter is declared for this property. /// </remarks> ! public override bool IsPolymorphic { get { return polymorphic; } } ! /// <summary></summary> ! public override RootClass RootClazz { get { return this; } } ! /// <summary></summary> ! public override ICollection PropertyClosureCollection { get { return PropertyCollection; } } ! /// <summary> /// Returns all of the Tables the Root class covers. *************** *** 167,174 **** /// The RootClass should only have one item in the Collection - the Table that it comes from. /// </remarks> ! public override ICollection TableClosureCollection { ! get ! { ArrayList retVal = new ArrayList(); retVal.Add( Table ); --- 176,183 ---- /// The RootClass should only have one item in the Collection - the Table that it comes from. /// </remarks> ! public override ICollection TableClosureCollection { ! get ! { ArrayList retVal = new ArrayList(); retVal.Add( Table ); *************** *** 177,187 **** } ! public override void AddSubclass(Subclass subclass) { ! base.AddSubclass(subclass); polymorphic = true; } ! public override bool IsExplicitPolymorphism { get { return explicitPolymorphism; } --- 186,201 ---- } ! /// <summary> ! /// ! /// </summary> ! /// <param name="subclass"></param> ! public override void AddSubclass( Subclass subclass ) { ! base.AddSubclass( subclass ); polymorphic = true; } ! /// <summary></summary> ! public override bool IsExplicitPolymorphism { get { return explicitPolymorphism; } *************** *** 195,199 **** /// <remarks> /// <para> ! /// The &;tlversion> element is optional and indicates that the table contains versioned data. /// This is particularly useful if you plan to use long transactions (see below). /// </para> --- 209,213 ---- /// <remarks> /// <para> ! /// The <version> element is optional and indicates that the table contains versioned data. /// This is particularly useful if you plan to use long transactions (see below). /// </para> *************** *** 225,229 **** /// </para> /// </remarks> ! public override Property Version { get { return version; } --- 239,243 ---- /// </para> /// </remarks> ! public override Property Version { get { return version; } *************** *** 236,245 **** /// </summary> /// <value><c>true</c> if there is a version property.</value> ! public override bool IsVersioned { get { return version != null; } } ! public override ICacheConcurrencyStrategy Cache { get { return cache; } --- 250,260 ---- /// </summary> /// <value><c>true</c> if there is a version property.</value> ! public override bool IsVersioned { get { return version != null; } } ! /// <summary></summary> ! public override ICacheConcurrencyStrategy Cache { get { return cache; } *************** *** 247,251 **** } ! public override bool IsMutable { get { return mutable; } --- 262,267 ---- } ! /// <summary></summary> ! public override bool IsMutable { get { return mutable; } *************** *** 253,257 **** } ! public override bool HasEmbeddedIdentifier { get { return embeddedIdentifier; } --- 269,274 ---- } ! /// <summary></summary> ! public override bool HasEmbeddedIdentifier { get { return embeddedIdentifier; } *************** *** 259,263 **** } ! public override System.Type Persister { get { return persister; } --- 276,281 ---- } ! /// <summary></summary> ! public override System.Type Persister { get { return persister; } *************** *** 265,280 **** } ! public override Table RootTable { get { return Table; } } ! public override PersistentClass Superclass { get { return null; } ! set { throw new InvalidOperationException("Can not set the Superclass on a RootClass."); } } ! public override Value Key { get { return Identifier; } --- 283,301 ---- } ! /// <summary></summary> ! public override Table RootTable { get { return Table; } } ! /// <summary></summary> ! public override PersistentClass Superclass { get { return null; } ! set { throw new InvalidOperationException( "Can not set the Superclass on a RootClass." ); } } ! /// <summary></summary> ! public override Value Key { get { return Identifier; } *************** *** 282,286 **** } ! public override bool IsForceDiscriminator { get { return forceDiscriminator; } --- 303,308 ---- } ! /// <summary></summary> ! public override bool IsForceDiscriminator { get { return forceDiscriminator; } *************** *** 288,297 **** } public override string Where { ! get { return where; } set { where = value; } } } ! } --- 310,320 ---- } + /// <summary></summary> public override string Where { ! get { return where; } set { where = value; } } } ! } \ No newline at end of file Index: Subclass.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Subclass.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Subclass.cs 13 Apr 2004 17:58:11 -0000 1.5 --- Subclass.cs 31 Dec 2004 21:27:54 -0000 1.6 *************** *** 1,21 **** using System; using System.Collections; - using NHibernate.Cache; - using NHibernate.Util; ! namespace NHibernate.Mapping { ! public class Subclass : PersistentClass { private PersistentClass superclass; private Value key; ! public Subclass(PersistentClass superclass) { this.superclass = superclass; } ! public override ICacheConcurrencyStrategy Cache { get { return Superclass.Cache; } --- 1,25 ---- using System; using System.Collections; using NHibernate.Cache; ! namespace NHibernate.Mapping { ! /// <summary></summary> ! public class Subclass : PersistentClass { private PersistentClass superclass; private Value key; ! /// <summary> ! /// ! /// </summary> ! /// <param name="superclass"></param> ! public Subclass( PersistentClass superclass ) { this.superclass = superclass; } ! /// <summary></summary> ! public override ICacheConcurrencyStrategy Cache { get { return Superclass.Cache; } *************** *** 23,32 **** } ! public override RootClass RootClazz { get { return Superclass.RootClazz; } } ! public override PersistentClass Superclass { get { return superclass; } --- 27,38 ---- } ! /// <summary></summary> ! public override RootClass RootClazz { get { return Superclass.RootClazz; } } ! /// <summary></summary> ! public override PersistentClass Superclass { get { return superclass; } *************** *** 34,38 **** } ! public override Property IdentifierProperty { get { return Superclass.IdentifierProperty; } --- 40,45 ---- } ! /// <summary></summary> ! public override Property IdentifierProperty { get { return Superclass.IdentifierProperty; } *************** *** 40,44 **** } ! public override Value Identifier { get { return Superclass.Identifier; } --- 47,52 ---- } ! /// <summary></summary> ! public override Value Identifier { get { return Superclass.Identifier; } *************** *** 46,96 **** } ! public override bool HasIdentifierProperty { get { return Superclass.HasIdentifierProperty; } } ! ! public override Value Discriminator { get { return Superclass.Discriminator; } set { Superclass.Discriminator = value; } } ! ! public override bool IsMutable { get { return Superclass.IsMutable; } set { Superclass.IsMutable = value; } } ! ! public override bool IsInherited { get { return true; } } ! ! public override bool IsPolymorphic { get { return true; } } ! ! public override void AddProperty(Property p) { ! base.AddProperty(p); ! Superclass.AddSubclassProperty(p); } ! ! public override Table Table { get { return base.Table; } ! set { base.Table = value; ! Superclass.AddSubclassTable(value); } } ! ! public override ICollection PropertyClosureCollection { ! get ! { ArrayList retVal = new ArrayList(); retVal.AddRange( PropertyCollection ); --- 54,115 ---- } ! /// <summary></summary> ! public override bool HasIdentifierProperty { get { return Superclass.HasIdentifierProperty; } } ! ! /// <summary></summary> ! public override Value Discriminator { get { return Superclass.Discriminator; } set { Superclass.Discriminator = value; } } ! ! /// <summary></summary> ! public override bool IsMutable { get { return Superclass.IsMutable; } set { Superclass.IsMutable = value; } } ! ! /// <summary></summary> ! public override bool IsInherited { get { return true; } } ! ! /// <summary></summary> ! public override bool IsPolymorphic { get { return true; } } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="p"></param> ! public override void AddProperty( Property p ) { ! base.AddProperty( p ); ! Superclass.AddSubclassProperty( p ); } ! ! /// <summary></summary> ! public override Table Table { get { return base.Table; } ! set { base.Table = value; ! Superclass.AddSubclassTable( value ); } } ! ! /// <summary></summary> ! public override ICollection PropertyClosureCollection { ! get ! { ArrayList retVal = new ArrayList(); retVal.AddRange( PropertyCollection ); *************** *** 99,106 **** } } ! ! public override ICollection TableClosureCollection { ! get { ArrayList retVal = new ArrayList(); --- 118,126 ---- } } ! ! /// <summary></summary> ! public override ICollection TableClosureCollection { ! get { ArrayList retVal = new ArrayList(); *************** *** 110,163 **** } } ! ! public override void AddSubclassProperty(Property p) { ! base.AddSubclassProperty(p); ! Superclass.AddSubclassProperty(p); } ! ! public override void AddSubclassTable(Table table) { ! base.AddSubclassTable(table); ! Superclass.AddSubclassTable(table); } ! ! public override bool IsVersioned { get { return Superclass.IsVersioned; } } ! ! public override Property Version { get { return Superclass.Version; } set { Superclass.Version = value; } } ! ! public override bool HasEmbeddedIdentifier { get { return Superclass.HasEmbeddedIdentifier; } set { Superclass.HasEmbeddedIdentifier = value; } } ! ! public override System.Type Persister { get { return Superclass.Persister; } set { Superclass.Persister = value; } } ! ! public override Table RootTable { get { return Superclass.RootTable; } } ! ! public override Value Key { ! get { ! if (key==null) { return Identifier; ! } ! else { return key; --- 130,197 ---- } } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="p"></param> ! public override void AddSubclassProperty( Property p ) { ! base.AddSubclassProperty( p ); ! Superclass.AddSubclassProperty( p ); } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="table"></param> ! public override void AddSubclassTable( Table table ) { ! base.AddSubclassTable( table ); ! Superclass.AddSubclassTable( table ); } ! ! /// <summary></summary> ! public override bool IsVersioned { get { return Superclass.IsVersioned; } } ! ! /// <summary></summary> ! public override Property Version { get { return Superclass.Version; } set { Superclass.Version = value; } } ! ! /// <summary></summary> ! public override bool HasEmbeddedIdentifier { get { return Superclass.HasEmbeddedIdentifier; } set { Superclass.HasEmbeddedIdentifier = value; } } ! ! /// <summary></summary> ! public override System.Type Persister { get { return Superclass.Persister; } set { Superclass.Persister = value; } } ! ! /// <summary></summary> ! public override Table RootTable { get { return Superclass.RootTable; } } ! ! /// <summary></summary> ! public override Value Key { ! get { ! if( key == null ) { return Identifier; ! } ! else { return key; *************** *** 166,171 **** set { key = value; } } ! ! public override bool IsExplicitPolymorphism { get { return Superclass.IsExplicitPolymorphism; } --- 200,206 ---- set { key = value; } } ! ! /// <summary></summary> ! public override bool IsExplicitPolymorphism { get { return Superclass.IsExplicitPolymorphism; } *************** *** 173,183 **** } public override string Where { ! get { return Superclass.Where; } ! set { throw new NotImplementedException("The Where string can not be set on the Subclass - use the RootClass instead."); } } } ! } --- 208,219 ---- } + /// <summary></summary> public override string Where { ! get { return Superclass.Where; } ! set { throw new NotImplementedException( "The Where string can not be set on the Subclass - use the RootClass instead." ); } } } ! } \ No newline at end of file Index: Set.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Set.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Set.cs 27 Apr 2004 15:49:22 -0000 1.5 --- Set.cs 31 Dec 2004 21:27:54 -0000 1.6 *************** *** 1,8 **** ! using System; ! ! using NCollection = NHibernate.Collection; using NHibernate.Type; ! namespace NHibernate.Mapping { /// <summary> --- 1,8 ---- ! using NHibernate.Collection; using NHibernate.Type; + using Collection_Set = NHibernate.Collection.Set; + using NCollection = NHibernate.Collection; ! namespace NHibernate.Mapping { /// <summary> *************** *** 11,17 **** /// element columns). /// </summary> ! public class Set : Collection { ! public Set(PersistentClass owner) : base(owner) { } --- 11,22 ---- /// element columns). /// </summary> ! public class Set : Collection { ! /// <summary> ! /// ! /// </summary> ! /// <param name="owner"></param> ! public Set( PersistentClass owner ) : base( owner ) ! { } *************** *** 19,23 **** /// <see cref="Collection.IsSet"/> /// </summary> ! public override bool IsSet { get { return true; } --- 24,28 ---- /// <see cref="Collection.IsSet"/> /// </summary> ! public override bool IsSet { get { return true; } *************** *** 27,37 **** /// <see cref="Collection.Type"/> /// </summary> ! public override PersistentCollectionType Type { ! get { return IsSorted ? ! TypeFactory.SortedSet(Role, Comparer) : ! TypeFactory.Set(Role); } } --- 32,42 ---- /// <see cref="Collection.Type"/> /// </summary> ! public override PersistentCollectionType Type { ! get { return IsSorted ? ! TypeFactory.SortedSet( Role, Comparer ) : ! TypeFactory.Set( Role ); } } *************** *** 40,73 **** /// <see cref="Collection.WrapperClass"/> /// </summary> ! public override System.Type WrapperClass { ! get { ! return IsSorted ? ! typeof(NCollection.SortedSet) : ! typeof(NCollection.Set); } } ! ! public void CreatePrimaryKey() { PrimaryKey pk = new PrimaryKey(); ! foreach(Column col in Key.ColumnCollection) { ! pk.AddColumn(col); } bool nullable = false; ! foreach(Column col in Element.ColumnCollection) { ! if(col.IsNullable) nullable = true; ! pk.AddColumn(col); } // some databases (Postgres) will tolerate nullable // column in a primary key - others (DB2) won't ! if(!nullable) Table.PrimaryKey = pk; } } ! } --- 45,84 ---- /// <see cref="Collection.WrapperClass"/> /// </summary> ! public override System.Type WrapperClass { ! get { ! return IsSorted ? ! typeof( SortedSet ) : ! typeof( Collection_Set ); } } ! /// <summary></summary> ! public void CreatePrimaryKey() { PrimaryKey pk = new PrimaryKey(); ! foreach( Column col in Key.ColumnCollection ) { ! pk.AddColumn( col ); } bool nullable = false; ! foreach( Column col in Element.ColumnCollection ) { ! if( col.IsNullable ) ! { ! nullable = true; ! } ! pk.AddColumn( col ); } // some databases (Postgres) will tolerate nullable // column in a primary key - others (DB2) won't ! if( !nullable ) ! { ! Table.PrimaryKey = pk; ! } } } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 21:27:55
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32099 Modified Files: OneToOne.cs PersistentClass.cs PrimaryKey.cs PrimitiveArray.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: PrimaryKey.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/PrimaryKey.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PrimaryKey.cs 13 Apr 2004 02:06:54 -0000 1.5 --- PrimaryKey.cs 31 Dec 2004 21:27:42 -0000 1.6 *************** *** 1,40 **** - using System; using System.Text; - using System.Collections; - using NHibernate.Dialect; using NHibernate.Util; ! namespace NHibernate.Mapping { ! public class PrimaryKey : Constraint { ! ! public string SqlConstraintString(Dialect.Dialect d) { ! StringBuilder buf = new StringBuilder(" primary key ("); ! int i=0; ! foreach(Column col in ColumnCollection) { ! buf.Append(col.GetQuotedName(d)); ! if (i < ColumnCollection.Count-1) buf.Append(StringHelper.CommaSpace); i++; } ! return buf.Append(StringHelper.ClosedParen).ToString(); } ! public override string SqlConstraintString(Dialect.Dialect d, string constraintName) { StringBuilder buf = new StringBuilder( ! d.GetAddPrimaryKeyConstraintString(constraintName)) ! .Append('('); ! int i=0; ! foreach(Column col in ColumnCollection) { ! buf.Append( col.GetQuotedName(d) ); ! if (i < ColumnCollection.Count - 1) buf.Append(StringHelper.CommaSpace); i++; } ! return buf.Append(StringHelper.ClosedParen).ToString(); } } ! } --- 1,54 ---- using System.Text; using NHibernate.Util; ! namespace NHibernate.Mapping { ! /// <summary></summary> ! public class PrimaryKey : Constraint { ! /// <summary> ! /// ! /// </summary> ! /// <param name="d"></param> ! /// <returns></returns> ! public string SqlConstraintString( Dialect.Dialect d ) { ! StringBuilder buf = new StringBuilder( " primary key (" ); ! int i = 0; ! foreach( Column col in ColumnCollection ) { ! buf.Append( col.GetQuotedName( d ) ); ! if( i < ColumnCollection.Count - 1 ) ! { ! buf.Append( StringHelper.CommaSpace ); ! } i++; } ! return buf.Append( StringHelper.ClosedParen ).ToString(); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="d"></param> ! /// <param name="constraintName"></param> ! /// <returns></returns> ! public override string SqlConstraintString( Dialect.Dialect d, string constraintName ) { StringBuilder buf = new StringBuilder( ! d.GetAddPrimaryKeyConstraintString( constraintName ) ) ! .Append( '(' ); ! int i = 0; ! foreach( Column col in ColumnCollection ) { ! buf.Append( col.GetQuotedName( d ) ); ! if( i < ColumnCollection.Count - 1 ) ! { ! buf.Append( StringHelper.CommaSpace ); ! } i++; } ! return buf.Append( StringHelper.ClosedParen ).ToString(); } } ! } \ No newline at end of file Index: PersistentClass.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/PersistentClass.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PersistentClass.cs 13 Sep 2004 07:32:50 -0000 1.14 --- PersistentClass.cs 31 Dec 2004 21:27:42 -0000 1.15 *************** *** 1,10 **** using System; using System.Collections; - using NHibernate.Cache; using NHibernate.SqlCommand; - using NHibernate.Util; ! namespace NHibernate.Mapping { /// <summary> --- 1,8 ---- using System; using System.Collections; using NHibernate.Cache; using NHibernate.SqlCommand; ! namespace NHibernate.Mapping { /// <summary> *************** *** 12,18 **** /// <see cref="Subclass"/> that is mapped by <subclass> or <joined-subclass> /// </summary> ! public abstract class PersistentClass { ! private static readonly Alias PKAlias = new Alias(15, "PK"); private System.Type persistentClass; --- 10,16 ---- /// <see cref="Subclass"/> that is mapped by <subclass> or <joined-subclass> /// </summary> ! public abstract class PersistentClass { ! private static readonly Alias PKAlias = new Alias( 15, "PK" ); private System.Type persistentClass; *************** *** 26,30 **** private bool dynamicInsert; private bool dynamicUpdate; ! /// <summary> /// Gets or Sets if the Insert Sql is built dynamically. --- 24,28 ---- private bool dynamicInsert; private bool dynamicUpdate; ! /// <summary> /// Gets or Sets if the Insert Sql is built dynamically. *************** *** 34,41 **** /// The value of this is set by the <c>dynamic-insert</c> attribute. /// </remarks> ! public virtual bool DynamicInsert { get { return dynamicInsert; } ! set { dynamicInsert = value ; } } --- 32,39 ---- /// The value of this is set by the <c>dynamic-insert</c> attribute. /// </remarks> ! public virtual bool DynamicInsert { get { return dynamicInsert; } ! set { dynamicInsert = value; } } *************** *** 47,54 **** /// The value of this is set by the <c>dynamic-update</c> attribute. /// </remarks> ! public virtual bool DynamicUpdate { get { return dynamicUpdate; } ! set { dynamicUpdate = value ; } } --- 45,52 ---- /// The value of this is set by the <c>dynamic-update</c> attribute. /// </remarks> ! public virtual bool DynamicUpdate { get { return dynamicUpdate; } ! set { dynamicUpdate = value; } } *************** *** 64,68 **** /// is the class name if no value is supplied. /// </remarks> ! public virtual string DiscriminatorValue { get { return discriminatorValue; } --- 62,66 ---- /// is the class name if no value is supplied. /// </remarks> ! public virtual string DiscriminatorValue { get { return discriminatorValue; } *************** *** 70,78 **** } ! public virtual void AddSubclass(Subclass subclass) { ! subclasses.Add(subclass); } public virtual bool HasSubclasses { --- 68,81 ---- } ! /// <summary> ! /// ! /// </summary> ! /// <param name="subclass"></param> ! public virtual void AddSubclass( Subclass subclass ) { ! subclasses.Add( subclass ); } + /// <summary></summary> public virtual bool HasSubclasses { *************** *** 80,89 **** } ! public virtual int SubclassSpan { ! get { int n = subclasses.Count; ! foreach(Subclass sc in subclasses) { n += sc.SubclassSpan; --- 83,93 ---- } ! /// <summary></summary> ! public virtual int SubclassSpan { ! get { int n = subclasses.Count; ! foreach( Subclass sc in subclasses ) { n += sc.SubclassSpan; *************** *** 100,119 **** /// it will pick those up also. /// </remarks> ! public virtual ICollection SubclassCollection { ! get ! { ArrayList retVal = new ArrayList(); ! // check to see if there are any subclass in our subclasses // and add them into the collection ! foreach(Subclass sc in subclasses) { ! retVal.AddRange(sc.SubclassCollection); } // finally add the subclasses from this PersistentClass into // the collection to return ! retVal.AddRange(subclasses); return retVal; --- 104,123 ---- /// it will pick those up also. /// </remarks> ! public virtual ICollection SubclassCollection { ! get ! { ArrayList retVal = new ArrayList(); ! // check to see if there are any subclass in our subclasses // and add them into the collection ! foreach( Subclass sc in subclasses ) { ! retVal.AddRange( sc.SubclassCollection ); } // finally add the subclasses from this PersistentClass into // the collection to return ! retVal.AddRange( subclasses ); return retVal; *************** *** 121,132 **** } ! public virtual ICollection DirectSubclasses { get { return subclasses; } } ! public virtual void AddProperty(Property p) { ! properties.Add(p); } --- 125,141 ---- } ! /// <summary></summary> ! public virtual ICollection DirectSubclasses { get { return subclasses; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="p"></param> ! public virtual void AddProperty( Property p ) { ! properties.Add( p ); } *************** *** 138,142 **** /// The value of this is set by the <c>table</c> attribute. /// </remarks> ! public virtual Table Table { get { return table; } --- 147,151 ---- /// The value of this is set by the <c>table</c> attribute. /// </remarks> ! public virtual Table Table { get { return table; } *************** *** 144,153 **** } ! public virtual ICollection PropertyCollection { get { return properties; } } ! public virtual System.Type PersistentClazz { get { return persistentClass; } --- 153,164 ---- } ! /// <summary></summary> ! public virtual ICollection PropertyCollection { get { return properties; } } ! /// <summary></summary> ! public virtual System.Type PersistentClazz { get { return persistentClass; } *************** *** 155,193 **** } ! public virtual string Name { get { return persistentClass.FullName; } } ! public abstract bool IsMutable { get; set;} public abstract bool HasIdentifierProperty { get; } public abstract Property IdentifierProperty { get; set; } ! public abstract Value Identifier { get; set; } ! public abstract Property Version { get; set; } ! public abstract Value Discriminator { get; set; } ! public abstract bool IsInherited { get; } // see the comment in RootClass about why the polymorphic setter is commented out ! public abstract bool IsPolymorphic { get; } ! public abstract bool IsVersioned { get;} ! public abstract ICacheConcurrencyStrategy Cache { get; set;} ! public abstract PersistentClass Superclass { get; set; } ! public abstract bool IsExplicitPolymorphism { get; set;} public abstract ICollection PropertyClosureCollection { get; } public abstract ICollection TableClosureCollection { get; } ! public virtual void AddSubclassProperty(Property p) { ! subclassProperties.Add(p); } ! public virtual void AddSubclassTable(Table table) { ! subclassTables.Add(table); } ! public virtual ICollection SubclassPropertyClosureCollection { ! get { ArrayList retVal = new ArrayList(); --- 166,240 ---- } ! /// <summary></summary> ! public virtual string Name { get { return persistentClass.FullName; } } ! /// <summary></summary> ! public abstract bool IsMutable { get; set; } ! ! /// <summary></summary> public abstract bool HasIdentifierProperty { get; } + + /// <summary></summary> public abstract Property IdentifierProperty { get; set; } ! ! /// <summary></summary> ! public abstract Value Identifier { get; set; } ! ! /// <summary></summary> ! public abstract Property Version { get; set; } ! ! /// <summary></summary> ! public abstract Value Discriminator { get; set; } ! ! /// <summary></summary> ! public abstract bool IsInherited { get; } ! // see the comment in RootClass about why the polymorphic setter is commented out ! /// <summary></summary> ! public abstract bool IsPolymorphic { get; } ! ! /// <summary></summary> ! public abstract bool IsVersioned { get; } ! ! /// <summary></summary> ! public abstract ICacheConcurrencyStrategy Cache { get; set; } ! ! /// <summary></summary> ! public abstract PersistentClass Superclass { get; set; } ! ! /// <summary></summary> ! public abstract bool IsExplicitPolymorphism { get; set; } + /// <summary></summary> public abstract ICollection PropertyClosureCollection { get; } + + /// <summary></summary> public abstract ICollection TableClosureCollection { get; } ! /// <summary> ! /// ! /// </summary> ! /// <param name="p"></param> ! public virtual void AddSubclassProperty( Property p ) { ! subclassProperties.Add( p ); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="table"></param> ! public virtual void AddSubclassTable( Table table ) { ! subclassTables.Add( table ); } ! /// <summary></summary> ! public virtual ICollection SubclassPropertyClosureCollection { ! get { ArrayList retVal = new ArrayList(); *************** *** 197,201 **** } } ! /// <summary> /// Returns an ICollection of all of the Tables that the subclass finds its information --- 244,248 ---- } } ! /// <summary> /// Returns an ICollection of all of the Tables that the subclass finds its information *************** *** 203,209 **** /// </summary> /// <remarks>It adds the TableClosureCollection and the subclassTables into the ICollection.</remarks> ! public virtual ICollection SubclassTableClosureCollection { ! get { ArrayList retVal = new ArrayList(); --- 250,256 ---- /// </summary> /// <remarks>It adds the TableClosureCollection and the subclassTables into the ICollection.</remarks> ! public virtual ICollection SubclassTableClosureCollection { ! get { ArrayList retVal = new ArrayList(); *************** *** 213,248 **** } } ! public virtual System.Type ProxyInterface { get { return proxyInterface; } ! set { proxyInterface = value ; } } ! public virtual bool IsForceDiscriminator { get { return false; } ! set { throw new NotImplementedException("subclasses need to override this method"); } } ! public abstract bool HasEmbeddedIdentifier { get; set;} ! public abstract System.Type Persister { get; set;} public abstract Table RootTable { get; } public abstract RootClass RootClazz { get; } - public abstract Value Key { get; set; } ! public virtual void CreatePrimaryKey(Dialect.Dialect dialect) { PrimaryKey pk = new PrimaryKey(); pk.Table = table; ! pk.Name = PKAlias.ToAliasString(table.Name, dialect); table.PrimaryKey = pk; ! foreach(Column col in Key.ColumnCollection) { ! pk.AddColumn(col); } } public abstract string Where { get; set; } ! } ! } --- 260,313 ---- } } ! ! /// <summary></summary> ! public virtual System.Type ProxyInterface { get { return proxyInterface; } ! set { proxyInterface = value; } } ! /// <summary></summary> ! public virtual bool IsForceDiscriminator ! { get { return false; } ! set { throw new NotImplementedException( "subclasses need to override this method" ); } } ! /// <summary></summary> ! public abstract bool HasEmbeddedIdentifier { get; set; } ! ! /// <summary></summary> ! public abstract System.Type Persister { get; set; } ! ! /// <summary></summary> public abstract Table RootTable { get; } + + /// <summary></summary> public abstract RootClass RootClazz { get; } ! /// <summary></summary> ! public abstract Value Key { get; set; } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="dialect"></param> ! public virtual void CreatePrimaryKey( Dialect.Dialect dialect ) { PrimaryKey pk = new PrimaryKey(); pk.Table = table; ! pk.Name = PKAlias.ToAliasString( table.Name, dialect ); table.PrimaryKey = pk; ! foreach( Column col in Key.ColumnCollection ) { ! pk.AddColumn( col ); } } + /// <summary></summary> public abstract string Where { get; set; } ! } ! } \ No newline at end of file Index: OneToOne.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/OneToOne.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** OneToOne.cs 13 Apr 2004 02:06:54 -0000 1.3 --- OneToOne.cs 31 Dec 2004 21:27:42 -0000 1.4 *************** *** 1,11 **** - using System; using System.Collections; - - using NHibernate.Util; using NHibernate.Type; ! namespace NHibernate.Mapping { ! public class OneToOne : Association { private bool constrained; --- 1,10 ---- using System.Collections; using NHibernate.Type; + using NHibernate.Util; ! namespace NHibernate.Mapping { ! /// <summary></summary> ! public class OneToOne : Association { private bool constrained; *************** *** 13,47 **** private Value identifier; ! public OneToOne(Table table, Value identifier) : base(table) { this.identifier = identifier; } ! public override void SetTypeByReflection(System.Type propertyClass, string propertyName) { ! try { ! if (Type==null) ! Type = TypeFactory.OneToOne(ReflectHelper.GetGetter(propertyClass, propertyName).ReturnType, foreignKeyType); ! } ! catch (HibernateException he) { ! throw new MappingException("Problem trying to set association type by reflection", he); } } ! public override void CreateForeignKey() { ! if (constrained) CreateForeignKeyOfClass( ((EntityType)Type).PersistentClass ); } ! public override IList ConstraintColumns { ! get { ArrayList list = new ArrayList(); ! foreach(object obj in identifier.ColumnCollection) { ! list.Add(obj); } return list; --- 12,63 ---- private Value identifier; ! /// <summary> ! /// ! /// </summary> ! /// <param name="table"></param> ! /// <param name="identifier"></param> ! public OneToOne( Table table, Value identifier ) : base( table ) { this.identifier = identifier; } ! /// <summary> ! /// ! /// </summary> ! /// <param name="propertyClass"></param> ! /// <param name="propertyName"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName ) { ! try { ! if( Type == null ) ! { ! Type = TypeFactory.OneToOne( ReflectHelper.GetGetter( propertyClass, propertyName ).ReturnType, foreignKeyType ); ! } ! } ! catch( HibernateException he ) { ! throw new MappingException( "Problem trying to set association type by reflection", he ); } } ! /// <summary></summary> ! public override void CreateForeignKey() { ! if( constrained ) ! { ! CreateForeignKeyOfClass( ( ( EntityType ) Type ).PersistentClass ); ! } } ! /// <summary></summary> ! public override IList ConstraintColumns { ! get { ArrayList list = new ArrayList(); ! foreach( object obj in identifier.ColumnCollection ) { ! list.Add( obj ); } return list; *************** *** 49,53 **** } ! public bool IsConstrained { get { return constrained; } --- 65,70 ---- } ! /// <summary></summary> ! public bool IsConstrained { get { return constrained; } *************** *** 55,59 **** } ! public ForeignKeyType ForeignKeyType { get { return foreignKeyType; } --- 72,77 ---- } ! /// <summary></summary> ! public ForeignKeyType ForeignKeyType { get { return foreignKeyType; } *************** *** 61,71 **** } ! public Value Identifier { get { return identifier; } set { identifier = value; } } ! ! } ! } --- 79,90 ---- } ! /// <summary></summary> ! public Value Identifier { get { return identifier; } set { identifier = value; } } ! ! } ! } \ No newline at end of file Index: PrimitiveArray.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/PrimitiveArray.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PrimitiveArray.cs 13 Apr 2004 02:06:54 -0000 1.3 --- PrimitiveArray.cs 31 Dec 2004 21:27:42 -0000 1.4 *************** *** 1,15 **** ! using System; ! ! namespace NHibernate.Mapping { ! public class PrimitiveArray : Array { ! ! public PrimitiveArray(PersistentClass owner) : base(owner) {} ! public override bool IsPrimitiveArray { get { return true; } } } ! } --- 1,20 ---- ! namespace NHibernate.Mapping { ! /// <summary></summary> ! public class PrimitiveArray : Array { ! /// <summary> ! /// ! /// </summary> ! /// <param name="owner"></param> ! public PrimitiveArray( PersistentClass owner ) : base( owner ) ! { ! } ! /// <summary></summary> ! public override bool IsPrimitiveArray { get { return true; } } } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 21:27:40
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32052 Modified Files: List.cs ManyToOne.cs Map.cs OneToMany.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: OneToMany.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/OneToMany.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** OneToMany.cs 13 Apr 2004 02:06:54 -0000 1.3 --- OneToMany.cs 31 Dec 2004 21:27:30 -0000 1.4 *************** *** 1,13 **** - using System; using NHibernate.Type; ! namespace NHibernate.Mapping { ! public class OneToMany { private EntityType type; private Table referencingTable; ! public EntityType Type { get { return type; } --- 1,14 ---- using NHibernate.Type; ! namespace NHibernate.Mapping { ! /// <summary></summary> ! public class OneToMany { private EntityType type; private Table referencingTable; ! /// <summary></summary> ! public EntityType Type { get { return type; } *************** *** 15,27 **** } ! public OneToMany(PersistentClass owner) { ! this.referencingTable = (owner==null) ? null : owner.Table; } ! public Table ReferencingTable { get { return referencingTable; } } } ! } --- 16,33 ---- } ! /// <summary> ! /// ! /// </summary> ! /// <param name="owner"></param> ! public OneToMany( PersistentClass owner ) { ! this.referencingTable = ( owner == null ) ? null : owner.Table; } ! /// <summary></summary> ! public Table ReferencingTable { get { return referencingTable; } } } ! } \ No newline at end of file Index: Map.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Map.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Map.cs 27 Apr 2004 15:49:22 -0000 1.5 --- Map.cs 31 Dec 2004 21:27:30 -0000 1.6 *************** *** 1,33 **** ! using System; ! using NHibernate.Type; using NHCollection = NHibernate.Collection; ! ! namespace NHibernate.Mapping ! { ! public class Map : IndexedCollection { ! public Map(PersistentClass owner) : base(owner) { } ! public override PersistentCollectionType Type { ! get ! { ! return IsSorted ? ! TypeFactory.SortedMap( Role, Comparer ) : ! TypeFactory.Map( Role ); } } ! public override System.Type WrapperClass { ! get ! { ! return IsSorted ? ! typeof(NHCollection.SortedMap) : ! typeof(NHCollection.Map); } } } ! } --- 1,41 ---- ! using NHibernate.Collection; using NHibernate.Type; + using Collection_Map = NHibernate.Collection.Map; using NHCollection = NHibernate.Collection; ! namespace NHibernate.Mapping ! { ! /// <summary></summary> ! public class Map : IndexedCollection { ! /// <summary> ! /// ! /// </summary> ! /// <param name="owner"></param> ! public Map( PersistentClass owner ) : base( owner ) ! { ! } ! /// <summary></summary> ! public override PersistentCollectionType Type { ! get ! { ! return IsSorted ? ! TypeFactory.SortedMap( Role, Comparer ) : ! TypeFactory.Map( Role ); } } ! /// <summary></summary> ! public override System.Type WrapperClass { ! get ! { ! return IsSorted ? ! typeof( SortedMap ) : ! typeof( Collection_Map ); } } } ! } \ No newline at end of file Index: ManyToOne.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/ManyToOne.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ManyToOne.cs 13 Apr 2004 02:06:54 -0000 1.3 --- ManyToOne.cs 31 Dec 2004 21:27:30 -0000 1.4 *************** *** 1,30 **** - using System; - using NHibernate.Util; using NHibernate.Type; ! namespace NHibernate.Mapping { ! public class ManyToOne : Association { ! ! public ManyToOne(Table table) : base(table) { } ! public override void SetTypeByReflection(System.Type propertyClass, string propertyName) { ! try { ! if (Type==null) ! Type = TypeFactory.ManyToOne( ReflectHelper.GetGetter(propertyClass, propertyName).ReturnType); ! } ! catch (HibernateException he) { ! throw new MappingException("Problem trying to set association type by reflection", he); } } ! public override void CreateForeignKey() { ! CreateForeignKeyOfClass( ( (EntityType)Type).PersistentClass ); } } ! } --- 1,43 ---- using NHibernate.Type; + using NHibernate.Util; ! namespace NHibernate.Mapping { ! /// <summary></summary> ! public class ManyToOne : Association { ! /// <summary> ! /// ! /// </summary> ! /// <param name="table"></param> ! public ManyToOne( Table table ) : base( table ) ! { ! } ! /// <summary> ! /// ! /// </summary> ! /// <param name="propertyClass"></param> ! /// <param name="propertyName"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName ) { ! try { ! if( Type == null ) ! { ! Type = TypeFactory.ManyToOne( ReflectHelper.GetGetter( propertyClass, propertyName ).ReturnType ); ! } ! } ! catch( HibernateException he ) { ! throw new MappingException( "Problem trying to set association type by reflection", he ); } } ! /// <summary></summary> ! public override void CreateForeignKey() { ! CreateForeignKeyOfClass( ( ( EntityType ) Type ).PersistentClass ); } } ! } \ No newline at end of file Index: List.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/List.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** List.cs 13 Apr 2004 02:06:54 -0000 1.6 --- List.cs 31 Dec 2004 21:27:30 -0000 1.7 *************** *** 1,28 **** - using System; - using NHibernate.Type; using NHCollection = NHibernate.Collection; ! namespace NHibernate.Mapping { /// <summary> /// A list has a primary key consisting of the key columns + index column /// </summary> ! public class List : IndexedCollection { ! public List(PersistentClass owner) : base(owner) ! { } ! public override PersistentCollectionType Type { get { return TypeFactory.List( Role ); } } ! public override System.Type WrapperClass { ! get { return typeof(NHCollection.List); } } ! } ! } --- 1,33 ---- using NHibernate.Type; + using Collection_List = NHibernate.Collection.List; using NHCollection = NHibernate.Collection; ! namespace NHibernate.Mapping { /// <summary> /// A list has a primary key consisting of the key columns + index column /// </summary> ! public class List : IndexedCollection { ! /// <summary> ! /// ! /// </summary> ! /// <param name="owner"></param> ! public List( PersistentClass owner ) : base( owner ) ! { } ! /// <summary></summary> ! public override PersistentCollectionType Type { get { return TypeFactory.List( Role ); } } ! /// <summary></summary> ! public override System.Type WrapperClass { ! get { return typeof( Collection_List ); } } ! } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 21:27:27
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31962 Modified Files: Index.cs IndexedCollection.cs IntegerValue.cs IRelationalModel.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: IntegerValue.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/IntegerValue.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IntegerValue.cs 13 Apr 2004 02:06:54 -0000 1.4 --- IntegerValue.cs 31 Dec 2004 21:27:02 -0000 1.5 *************** *** 1,15 **** - using System; using NHibernate.Type; ! namespace NHibernate.Mapping ! { public class IntegerValue : Value { ! public IntegerValue(Table table) : base(table) { } ! public override IType Type { get { return NHibernate.Int32; } } } ! } --- 1,22 ---- using NHibernate.Type; ! namespace NHibernate.Mapping ! { ! /// <summary></summary> public class IntegerValue : Value { ! /// <summary> ! /// ! /// </summary> ! /// <param name="table"></param> ! public IntegerValue( Table table ) : base( table ) ! { ! } ! /// <summary></summary> ! public override IType Type { get { return NHibernate.Int32; } } } ! } \ No newline at end of file Index: Index.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Index.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Index.cs 13 Apr 2004 02:06:54 -0000 1.4 --- Index.cs 31 Dec 2004 21:27:02 -0000 1.5 *************** *** 1,12 **** - using System; using System.Collections; using System.Text; using NHibernate.Engine; using NHibernate.Util; - using NHibernate.Dialect; ! namespace NHibernate.Mapping { ! public class Index : IRelationalModel { private Table table; --- 1,11 ---- using System.Collections; using System.Text; using NHibernate.Engine; using NHibernate.Util; ! namespace NHibernate.Mapping { ! /// <summary></summary> ! public class Index : IRelationalModel { private Table table; *************** *** 14,44 **** private string name; ! public string SqlCreateString(Dialect.Dialect dialect, IMapping p) { ! StringBuilder buf = new StringBuilder("create index ") ! .Append( dialect.QualifyIndexName ? name : StringHelper.Unqualify(name) ) ! .Append(" on ") ! .Append( table.GetQualifiedName(dialect)) ! .Append(" ("); ! bool commaNeeded = false; ! for(int i=0; i<columns.Count; i++) { ! if(commaNeeded) buf.Append(StringHelper.CommaSpace); commaNeeded = true; ! buf.Append( ((Column)columns[i]).GetQuotedName(dialect) ); } ! buf.Append(StringHelper.ClosedParen); return buf.ToString(); } ! public string SqlDropString(Dialect.Dialect dialect) { ! return "drop index " + table.GetQualifiedName(dialect) + StringHelper.Dot + name; } ! public Table Table { get { return table; } --- 13,58 ---- private string name; ! /// <summary> ! /// ! /// </summary> ! /// <param name="dialect"></param> ! /// <param name="p"></param> ! /// <returns></returns> ! public string SqlCreateString( Dialect.Dialect dialect, IMapping p ) { ! StringBuilder buf = new StringBuilder( "create index " ) ! .Append( dialect.QualifyIndexName ? name : StringHelper.Unqualify( name ) ) ! .Append( " on " ) ! .Append( table.GetQualifiedName( dialect ) ) ! .Append( " (" ); ! bool commaNeeded = false; ! for( int i = 0; i < columns.Count; i++ ) { ! if( commaNeeded ) ! { ! buf.Append( StringHelper.CommaSpace ); ! } commaNeeded = true; ! buf.Append( ( ( Column ) columns[ i ] ).GetQuotedName( dialect ) ); } ! buf.Append( StringHelper.ClosedParen ); return buf.ToString(); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="dialect"></param> ! /// <returns></returns> ! public string SqlDropString( Dialect.Dialect dialect ) { ! return "drop index " + table.GetQualifiedName( dialect ) + StringHelper.Dot + name; } ! /// <summary></summary> ! public Table Table { get { return table; } *************** *** 46,60 **** } ! public ICollection ColumnCollection { get { return columns; } } ! public void AddColumn(Column column) { ! if (!columns.Contains(column)) columns.Add(column); } ! public string Name { get { return name; } --- 60,83 ---- } ! /// <summary></summary> ! public ICollection ColumnCollection { get { return columns; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="column"></param> ! public void AddColumn( Column column ) { ! if( !columns.Contains( column ) ) ! { ! columns.Add( column ); ! } } ! /// <summary></summary> ! public string Name { get { return name; } *************** *** 62,64 **** } } ! } --- 85,87 ---- } } ! } \ No newline at end of file Index: IRelationalModel.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/IRelationalModel.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IRelationalModel.cs 13 Apr 2004 02:06:54 -0000 1.2 --- IRelationalModel.cs 31 Dec 2004 21:27:02 -0000 1.3 *************** *** 1,12 **** - using System; - using NHibernate.Engine; ! namespace NHibernate.Mapping { ! public interface IRelationalModel { ! string SqlCreateString(Dialect.Dialect dialect, IMapping p); ! string SqlDropString(Dialect.Dialect dialect); } ! } --- 1,23 ---- using NHibernate.Engine; ! namespace NHibernate.Mapping { ! /// <summary></summary> ! public interface IRelationalModel { ! /// <summary> ! /// ! /// </summary> ! /// <param name="dialect"></param> ! /// <param name="p"></param> ! /// <returns></returns> ! string SqlCreateString( Dialect.Dialect dialect, IMapping p ); ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="dialect"></param> ! /// <returns></returns> ! string SqlDropString( Dialect.Dialect dialect ); } ! } \ No newline at end of file Index: IndexedCollection.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/IndexedCollection.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IndexedCollection.cs 22 Nov 2004 03:56:00 -0000 1.4 --- IndexedCollection.cs 31 Dec 2004 21:27:02 -0000 1.5 *************** *** 1,5 **** ! using System; ! ! namespace NHibernate.Mapping { /// <summary> --- 1,3 ---- ! namespace NHibernate.Mapping { /// <summary> *************** *** 7,21 **** /// and primitive Arrays. /// </summary> ! public abstract class IndexedCollection : Collection { public const string DefaultIndexColumnName = "idx"; private Value index; ! protected IndexedCollection(PersistentClass owner) : base(owner) ! { } ! public Value Index { get { return index; } --- 5,25 ---- /// and primitive Arrays. /// </summary> ! public abstract class IndexedCollection : Collection { + /// <summary></summary> public const string DefaultIndexColumnName = "idx"; private Value index; ! /// <summary> ! /// ! /// </summary> ! /// <param name="owner"></param> ! protected IndexedCollection( PersistentClass owner ) : base( owner ) ! { } ! /// <summary></summary> ! public Value Index { get { return index; } *************** *** 23,42 **** } ! public override bool IsIndexed { get { return true; } } ! public void CreatePrimaryKey() { PrimaryKey pk = new PrimaryKey(); ! ! foreach(Column col in Key.ColumnCollection ) { ! pk.AddColumn(col); } ! foreach(Column col in Index.ColumnCollection) { ! pk.AddColumn(col); } --- 27,48 ---- } ! /// <summary></summary> ! public override bool IsIndexed { get { return true; } } ! /// <summary></summary> ! public void CreatePrimaryKey() { PrimaryKey pk = new PrimaryKey(); ! ! foreach( Column col in Key.ColumnCollection ) { ! pk.AddColumn( col ); } ! foreach( Column col in Index.ColumnCollection ) { ! pk.AddColumn( col ); } *************** *** 44,46 **** } } ! } --- 50,52 ---- } } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 21:27:00
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31915 Modified Files: ForeignKey.cs Formula.cs IdentifierBag.cs IdentifierCollection.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: IdentifierCollection.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/IdentifierCollection.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IdentifierCollection.cs 22 Nov 2004 03:56:00 -0000 1.2 --- IdentifierCollection.cs 31 Dec 2004 21:26:49 -0000 1.3 *************** *** 1,5 **** - using System; - using System.Collections; - namespace NHibernate.Mapping { --- 1,2 ---- *************** *** 9,20 **** public abstract class IdentifierCollection : Collection { public static readonly string DefaultIdentifierColumnName = "id"; private Value identifier; ! protected IdentifierCollection(PersistentClass owner) : base(owner) { } ! public Value Identifier { get { return identifier; } --- 6,23 ---- public abstract class IdentifierCollection : Collection { + /// <summary></summary> public static readonly string DefaultIdentifierColumnName = "id"; private Value identifier; ! /// <summary> ! /// ! /// </summary> ! /// <param name="owner"></param> ! protected IdentifierCollection( PersistentClass owner ) : base( owner ) { } ! /// <summary></summary> ! public Value Identifier { get { return identifier; } *************** *** 22,25 **** --- 25,29 ---- } + /// <summary></summary> public override bool IsIdentified { *************** *** 27,36 **** } ! public void CreatePrimaryKey() { PrimaryKey pk = new PrimaryKey(); ! foreach(Column col in Identifier.ColumnCollection) { ! pk.AddColumn(col); } --- 31,41 ---- } ! /// <summary></summary> ! public void CreatePrimaryKey() { PrimaryKey pk = new PrimaryKey(); ! foreach( Column col in Identifier.ColumnCollection ) { ! pk.AddColumn( col ); } *************** *** 39,41 **** } ! } --- 44,46 ---- } ! } \ No newline at end of file Index: Formula.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Formula.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Formula.cs 23 Jun 2004 21:03:34 -0000 1.3 --- Formula.cs 31 Dec 2004 21:26:49 -0000 1.4 *************** *** 1,22 **** using System; - using System.Collections; - using NHibernate.Dialect; using NHibernate.SqlCommand; using NHibernate.Util; ! namespace NHibernate.Mapping { ! public class Formula ! { private static int formulaUniqueInteger=0; ! private string formula; ! private int uniqueInteger; ! public Formula() ! { uniqueInteger = formulaUniqueInteger++; } ! public String GetTemplate(Dialect.Dialect dialect) ! { return Template.RenderWhereStringTemplate(formula, dialect); } public String Alias ! { get ! { return "f" + uniqueInteger.ToString() + StringHelper.Underscore; } } public string FormulaString { ! get { return formula; } set { this.formula = value; } } } } \ No newline at end of file --- 1,45 ---- using System; using NHibernate.SqlCommand; using NHibernate.Util; ! namespace NHibernate.Mapping { ! /// <summary></summary> ! public class Formula ! { ! private static int formulaUniqueInteger = 0; ! ! private string formula; ! ! private int uniqueInteger; ! ! /// <summary></summary> ! public Formula() ! { ! uniqueInteger = formulaUniqueInteger++; ! } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="dialect"></param> ! /// <returns></returns> ! public String GetTemplate( Dialect.Dialect dialect ) ! { ! return Template.RenderWhereStringTemplate( formula, dialect ); ! } ! ! /// <summary></summary> public String Alias ! { ! get { return "f" + uniqueInteger.ToString() + StringHelper.Underscore; } ! } ! ! /// <summary></summary> public string FormulaString { ! get { return formula; } ! set { this.formula = value; } ! } ! } ! } \ No newline at end of file Index: ForeignKey.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/ForeignKey.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ForeignKey.cs 13 Apr 2004 02:06:54 -0000 1.5 --- ForeignKey.cs 31 Dec 2004 21:26:49 -0000 1.6 *************** *** 1,51 **** - using System; using System.Collections; - using NHibernate.Dialect; ! namespace NHibernate.Mapping ! { ! public class ForeignKey : Constraint { private Table referencedTable; private System.Type referencedClass; ! public ForeignKey() { } ! public override string SqlConstraintString(Dialect.Dialect d, string constraintName) { ! string[] cols = new string[ ColumnSpan ]; ! string[] refcols = new string[ ColumnSpan ]; ! int i=0; ! ! foreach(Column col in referencedTable.PrimaryKey.ColumnCollection) { ! refcols[i] = col.GetQuotedName(d); i++; } ! i=0; ! foreach(Column col in ColumnCollection) { ! cols[i] = col.GetQuotedName(d); i++; } ! return d.GetAddForeignKeyConstraintString(constraintName, cols, referencedTable.GetQualifiedName(d), refcols); } ! public Table ReferencedTable { get { return referencedTable; } ! set { ! if (value.PrimaryKey.ColumnSpan != ColumnSpan) ! throw new MappingException("Foreign key must have same number of columns as referenced primary key"); IEnumerator fkCols = ColumnCollection.GetEnumerator(); IEnumerator pkCols = value.PrimaryKey.ColumnCollection.GetEnumerator(); ! while( fkCols.MoveNext() && pkCols.MoveNext() ) { ! ((Column)fkCols.Current).Length = ((Column)pkCols.Current).Length; } --- 1,62 ---- using System.Collections; ! namespace NHibernate.Mapping ! { ! /// <summary></summary> ! public class ForeignKey : Constraint { private Table referencedTable; private System.Type referencedClass; ! /// <summary></summary> ! public ForeignKey() ! { ! } ! /// <summary> ! /// ! /// </summary> ! /// <param name="d"></param> ! /// <param name="constraintName"></param> ! /// <returns></returns> ! public override string SqlConstraintString( Dialect.Dialect d, string constraintName ) { ! string[ ] cols = new string[ColumnSpan]; ! string[ ] refcols = new string[ColumnSpan]; ! int i = 0; ! ! foreach( Column col in referencedTable.PrimaryKey.ColumnCollection ) { ! refcols[ i ] = col.GetQuotedName( d ); i++; } ! i = 0; ! foreach( Column col in ColumnCollection ) { ! cols[ i ] = col.GetQuotedName( d ); i++; } ! return d.GetAddForeignKeyConstraintString( constraintName, cols, referencedTable.GetQualifiedName( d ), refcols ); } ! /// <summary></summary> ! public Table ReferencedTable { get { return referencedTable; } ! set { ! if( value.PrimaryKey.ColumnSpan != ColumnSpan ) ! { ! throw new MappingException( "Foreign key must have same number of columns as referenced primary key" ); ! } IEnumerator fkCols = ColumnCollection.GetEnumerator(); IEnumerator pkCols = value.PrimaryKey.ColumnCollection.GetEnumerator(); ! while( fkCols.MoveNext() && pkCols.MoveNext() ) { ! ( ( Column ) fkCols.Current ).Length = ( ( Column ) pkCols.Current ).Length; } *************** *** 54,58 **** } ! public System.Type ReferencedClass { get { return referencedClass; } --- 65,70 ---- } ! /// <summary></summary> ! public System.Type ReferencedClass { get { return referencedClass; } *************** *** 60,62 **** } } ! } --- 72,74 ---- } } ! } \ No newline at end of file Index: IdentifierBag.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/IdentifierBag.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IdentifierBag.cs 3 May 2004 04:56:43 -0000 1.2 --- IdentifierBag.cs 31 Dec 2004 21:26:49 -0000 1.3 *************** *** 1,6 **** - using System; - - using NHCollection = NHibernate.Collection; using NHibernate.Type; namespace NHibernate.Mapping --- 1,5 ---- using NHibernate.Type; + using Collection_IdentifierBag = NHibernate.Collection.IdentifierBag; + using NHCollection = NHibernate.Collection; namespace NHibernate.Mapping *************** *** 12,35 **** public class IdentifierBag : IdentifierCollection { ! public IdentifierBag(PersistentClass owner) : base(owner) { } ! public override PersistentCollectionType Type { ! get ! { ! return TypeFactory.IdBag(Role); ! } } ! ! public override System.Type WrapperClass { ! get ! { ! return typeof(NHCollection.IdentifierBag) ; ! } } ! } ! } --- 11,34 ---- public class IdentifierBag : IdentifierCollection { ! /// <summary> ! /// ! /// </summary> ! /// <param name="owner"></param> ! public IdentifierBag( PersistentClass owner ) : base( owner ) { } ! /// <summary></summary> ! public override PersistentCollectionType Type { ! get { return TypeFactory.IdBag( Role ); } } ! ! /// <summary></summary> ! public override System.Type WrapperClass { ! get { return typeof( Collection_IdentifierBag ); } } ! } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 21:26:51
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31863 Modified Files: Collection.cs Column.cs Component.cs Constraint.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: Collection.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Collection.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Collection.cs 3 May 2004 14:13:16 -0000 1.6 --- Collection.cs 31 Dec 2004 21:26:38 -0000 1.7 *************** *** 1,15 **** - using System; using System.Collections; - using NHibernate.Cache; using NHibernate.Type; - using NHibernate.Util; ! namespace NHibernate.Mapping { ! ! public abstract class Collection { public const string DefaultElementColumnName = "elt"; public const string DefaultKeyColumnName = "id"; --- 1,15 ---- using System.Collections; using NHibernate.Cache; using NHibernate.Type; ! namespace NHibernate.Mapping { ! /// <summary></summary> ! public abstract class Collection { + /// <summary></summary> public const string DefaultElementColumnName = "elt"; + + /// <summary></summary> public const string DefaultKeyColumnName = "id"; *************** *** 30,44 **** private bool orphanDelete; ! protected Collection(PersistentClass owner) { this.owner = owner; } ! public virtual bool IsSet { get { return false; } } ! public Value Key { get { return key; } --- 30,50 ---- private bool orphanDelete; ! /// <summary> ! /// ! /// </summary> ! /// <param name="owner"></param> ! protected Collection( PersistentClass owner ) { this.owner = owner; } ! /// <summary></summary> ! public virtual bool IsSet { get { return false; } } ! /// <summary></summary> ! public Value Key { get { return key; } *************** *** 46,50 **** } ! public Value Element { get { return element; } --- 52,57 ---- } ! /// <summary></summary> ! public Value Element { get { return element; } *************** *** 52,61 **** } ! public virtual bool IsIndexed { get { return false; } } ! public Table Table { get { return table; } --- 59,70 ---- } ! /// <summary></summary> ! public virtual bool IsIndexed { get { return false; } } ! /// <summary></summary> ! public Table Table { get { return table; } *************** *** 63,67 **** } ! public bool IsSorted { get { return sorted; } --- 72,77 ---- } ! /// <summary></summary> ! public bool IsSorted { get { return sorted; } *************** *** 69,73 **** } ! public IComparer Comparer { get { return comparer; } --- 79,84 ---- } ! /// <summary></summary> ! public IComparer Comparer { get { return comparer; } *************** *** 75,79 **** } ! public bool IsLazy { get { return lazy; } --- 86,91 ---- } ! /// <summary></summary> ! public bool IsLazy { get { return lazy; } *************** *** 81,85 **** } ! public string Role { get { return role; } --- 93,98 ---- } ! /// <summary></summary> ! public string Role { get { return role; } *************** *** 87,109 **** } public abstract PersistentCollectionType Type { get; } public abstract System.Type WrapperClass { get; } ! public virtual bool IsPrimitiveArray { get { return false; } } ! public virtual bool IsArray { get { return false; } } ! public virtual bool IsIdentified { get { return false; } } ! public bool IsOneToMany { get { return isOneToMany; } --- 100,129 ---- } + /// <summary></summary> public abstract PersistentCollectionType Type { get; } + + /// <summary></summary> public abstract System.Type WrapperClass { get; } ! /// <summary></summary> ! public virtual bool IsPrimitiveArray { get { return false; } } ! /// <summary></summary> ! public virtual bool IsArray { get { return false; } } ! /// <summary></summary> ! public virtual bool IsIdentified { get { return false; } } ! /// <summary></summary> ! public bool IsOneToMany { get { return isOneToMany; } *************** *** 111,115 **** } ! public OneToMany OneToMany { get { return oneToMany; } --- 131,136 ---- } ! /// <summary></summary> ! public OneToMany OneToMany { get { return oneToMany; } *************** *** 117,126 **** } ! public ICacheConcurrencyStrategy Cache { get { return cache; } set { cache = value; } } ! public bool IsInverse { get { return inverse; } --- 138,150 ---- } ! /// <summary></summary> ! public ICacheConcurrencyStrategy Cache ! { get { return cache; } set { cache = value; } } ! /// <summary></summary> ! public bool IsInverse { get { return inverse; } *************** *** 128,136 **** } ! public System.Type OwnerClass { get { return owner.PersistentClazz; } } ! public PersistentClass Owner { get { return owner; } --- 152,163 ---- } ! /// <summary></summary> ! public System.Type OwnerClass ! { get { return owner.PersistentClazz; } } ! /// <summary></summary> ! public PersistentClass Owner { get { return owner; } *************** *** 138,142 **** } ! public string OrderBy { get { return orderBy; } --- 165,170 ---- } ! /// <summary></summary> ! public string OrderBy { get { return orderBy; } *************** *** 144,148 **** } ! public string Where { get { return where; } --- 172,177 ---- } ! /// <summary></summary> ! public string Where { get { return where; } *************** *** 150,154 **** } ! public bool OrphanDelete { get { return orphanDelete; } --- 179,184 ---- } ! /// <summary></summary> ! public bool OrphanDelete { get { return orphanDelete; } *************** *** 157,159 **** } ! } --- 187,189 ---- } ! } \ No newline at end of file Index: Column.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Column.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Column.cs 16 Aug 2004 05:27:07 -0000 1.13 --- Column.cs 31 Dec 2004 21:26:38 -0000 1.14 *************** *** 1,16 **** using System; - using System.Data; - using NHibernate.Dialect; using NHibernate.Engine; - using NHibernate.Type; - using NHibernate.Util; using NHibernate.SqlCommand; using NHibernate.SqlTypes; ! namespace NHibernate.Mapping { ! public class Column { - private static readonly int DefaultPropertyLength = 255; --- 1,14 ---- using System; using NHibernate.Engine; using NHibernate.SqlCommand; using NHibernate.SqlTypes; + using NHibernate.Type; + using NHibernate.Util; ! namespace NHibernate.Mapping { ! /// <summary></summary> ! public class Column { private static readonly int DefaultPropertyLength = 255; *************** *** 23,29 **** private string sqlType; private bool quoted = false; internal int uniqueInteger; ! public int Length { get { return length; } --- 21,30 ---- private string sqlType; private bool quoted = false; + + /// <summary></summary> internal int uniqueInteger; ! /// <summary></summary> ! public int Length { get { return length; } *************** *** 31,35 **** } ! public IType Type { get { return type; } --- 32,37 ---- } ! /// <summary></summary> ! public IType Type { get { return type; } *************** *** 37,96 **** } ! public string Name { get { return name; } ! set ! { ! if (value[0] == '`') { quoted = true; ! name = value.Substring(1, value.Length - 2); } ! else { ! name = value; } } } ! public string GetQuotedName(Dialect.Dialect d) { return IsQuoted ? ! d.QuoteForColumnName(name) : name; } ! public string Alias(Dialect.Dialect d) { ! if(quoted) ! return "y" + uniqueInteger.ToString() + StringHelper.Underscore; ! ! if ( name.Length < 11 ) ! return name; ! else ! return (new Alias(10, uniqueInteger.ToString() + StringHelper.Underscore)).ToAliasString(name, d); } ! public string Alias(Dialect.Dialect d, string suffix) { ! ! if(quoted) return "y" + uniqueInteger.ToString() + StringHelper.Underscore; ! if( (name.Length + suffix.Length) < 11 ) return name + suffix; //return name.Substring(0, name.Length - suffix.Length); else ! return (new Alias(10, uniqueInteger.ToString() + StringHelper.Underscore + suffix) ).ToAliasString(name, d); } ! public bool IsNullable ! { get { return nullable; } set { nullable = value; } } ! public Column(IType type, int typeIndex) { this.type = type; --- 39,132 ---- } ! /// <summary></summary> ! public string Name { get { return name; } ! set ! { ! if( value[ 0 ] == '`' ) { quoted = true; ! name = value.Substring( 1, value.Length - 2 ); } ! else { ! name = value; } } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="d"></param> ! /// <returns></returns> ! public string GetQuotedName( Dialect.Dialect d ) { return IsQuoted ? ! d.QuoteForColumnName( name ) : name; } ! /// <summary> ! /// ! /// </summary> ! /// <param name="d"></param> ! /// <returns></returns> ! public string Alias( Dialect.Dialect d ) { ! if( quoted ) ! { ! return "y" + uniqueInteger.ToString() + StringHelper.Underscore; ! } ! ! if( name.Length < 11 ) ! { ! return name; ! } ! else ! { ! return ( new Alias( 10, uniqueInteger.ToString() + StringHelper.Underscore ) ).ToAliasString( name, d ); ! } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="d"></param> ! /// <param name="suffix"></param> ! /// <returns></returns> ! public string Alias( Dialect.Dialect d, string suffix ) { ! if( quoted ) ! { return "y" + uniqueInteger.ToString() + StringHelper.Underscore; + } ! if( ( name.Length + suffix.Length ) < 11 ) ! { return name + suffix; + } //return name.Substring(0, name.Length - suffix.Length); else ! { ! return ( new Alias( 10, uniqueInteger.ToString() + StringHelper.Underscore + suffix ) ).ToAliasString( name, d ); ! } } ! /// <summary></summary> ! public bool IsNullable ! { get { return nullable; } set { nullable = value; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="type"></param> ! /// <param name="typeIndex"></param> ! public Column( IType type, int typeIndex ) { this.type = type; *************** *** 98,125 **** } ! public int TypeIndex { get { return typeIndex; } set { typeIndex = value; } } ! public SqlType GetAutoSqlType(IMapping mapping) { ! try { ! return Type.SqlTypes(mapping)[TypeIndex]; } ! catch(Exception e) { throw new MappingException( ! "GetAutoSqlType - Could not determine type for column " + ! name + ! " of type " + ! type.GetType().FullName + ! ": " + ! e.GetType().FullName, e); } } ! public bool IsUnique { get { return unique; } --- 134,169 ---- } ! /// <summary></summary> ! public int TypeIndex ! { get { return typeIndex; } set { typeIndex = value; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="mapping"></param> ! /// <returns></returns> ! public SqlType GetAutoSqlType( IMapping mapping ) { ! try { ! return Type.SqlTypes( mapping )[ TypeIndex ]; } ! catch( Exception e ) { throw new MappingException( ! "GetAutoSqlType - Could not determine type for column " + ! name + ! " of type " + ! type.GetType().FullName + ! ": " + ! e.GetType().FullName, e ); } } ! /// <summary></summary> ! public bool IsUnique { get { return unique; } *************** *** 127,163 **** } ! public string GetSqlType(Dialect.Dialect dialect, IMapping mapping) ! { ! if(sqlType==null) { ! SqlType sqlTypeObject = GetAutoSqlType(mapping); return dialect.GetTypeName( sqlTypeObject, Length ); } ! else { return sqlType; } } - ! public override bool Equals(object obj) { ! return obj is Column && Equals( (Column) obj ); } ! public bool Equals(Column column) { ! if (null == column) return false; ! if (this == column) return true; ! return name.Equals(column.Name); } ! public override int GetHashCode() { return name.GetHashCode(); } ! public string SqlType { get { return sqlType; } --- 171,230 ---- } ! /// <summary> ! /// ! /// </summary> ! /// <param name="dialect"></param> ! /// <param name="mapping"></param> ! /// <returns></returns> ! public string GetSqlType( Dialect.Dialect dialect, IMapping mapping ) ! { ! if( sqlType == null ) { ! SqlType sqlTypeObject = GetAutoSqlType( mapping ); return dialect.GetTypeName( sqlTypeObject, Length ); } ! else { return sqlType; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="obj"></param> ! /// <returns></returns> ! public override bool Equals( object obj ) { ! return obj is Column && Equals( ( Column ) obj ); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="column"></param> ! /// <returns></returns> ! public bool Equals( Column column ) { ! if( null == column ) ! { ! return false; ! } ! if( this == column ) ! { ! return true; ! } ! return name.Equals( column.Name ); } ! /// <summary></summary> ! public override int GetHashCode() { return name.GetHashCode(); } ! /// <summary></summary> ! public string SqlType { get { return sqlType; } *************** *** 165,169 **** } ! public bool IsQuoted { get { return quoted; } --- 232,237 ---- } ! /// <summary></summary> ! public bool IsQuoted { get { return quoted; } *************** *** 172,174 **** } ! } --- 240,242 ---- } ! } \ No newline at end of file Index: Constraint.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Constraint.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Constraint.cs 13 Apr 2004 02:06:54 -0000 1.4 --- Constraint.cs 31 Dec 2004 21:26:38 -0000 1.5 *************** *** 1,12 **** - using System; - using System.Text; using System.Collections; ! using NHibernate.Dialect; using NHibernate.Engine; - using NHibernate.Util; ! namespace NHibernate.Mapping { ! public abstract class Constraint : IRelationalModel { private string name; --- 1,10 ---- using System.Collections; ! using System.Text; using NHibernate.Engine; ! namespace NHibernate.Mapping { ! /// <summary></summary> ! public abstract class Constraint : IRelationalModel { private string name; *************** *** 14,18 **** private Table table; ! public string Name { get { return name; } --- 12,17 ---- private Table table; ! /// <summary></summary> ! public string Name { get { return name; } *************** *** 20,39 **** } ! public ICollection ColumnCollection { get { return columns; } } ! public void AddColumn(Column column) { ! if ( !columns.Contains(column) ) columns.Add(column); } ! public int ColumnSpan { get { return columns.Count; } } ! public Table Table { get { return table; } --- 19,48 ---- } ! /// <summary></summary> ! public ICollection ColumnCollection { get { return columns; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="column"></param> ! public void AddColumn( Column column ) { ! if( !columns.Contains( column ) ) ! { ! columns.Add( column ); ! } } ! /// <summary></summary> ! public int ColumnSpan { get { return columns.Count; } } ! /// <summary></summary> ! public Table Table { get { return table; } *************** *** 41,59 **** } ! public string SqlDropString(Dialect.Dialect dialect) { ! return "alter table " + Table.GetQualifiedName(dialect)+ " drop constraint " + Name; } ! 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(); } ! public abstract string SqlConstraintString(Dialect.Dialect d, string constraintName); } ! } --- 50,85 ---- } ! /// <summary> ! /// ! /// </summary> ! /// <param name="dialect"></param> ! /// <returns></returns> ! public string SqlDropString( Dialect.Dialect dialect ) { ! return "alter table " + Table.GetQualifiedName( dialect ) + " drop constraint " + Name; } ! /// <summary> ! /// ! /// </summary> ! /// <param name="dialect"></param> ! /// <param name="p"></param> ! /// <returns></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(); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="d"></param> ! /// <param name="constraintName"></param> ! /// <returns></returns> ! public abstract string SqlConstraintString( Dialect.Dialect d, string constraintName ); } ! } \ No newline at end of file Index: Component.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Component.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Component.cs 13 Apr 2004 02:06:54 -0000 1.5 --- Component.cs 31 Dec 2004 21:26:38 -0000 1.6 *************** *** 1,9 **** using System; - using System.Data; using System.Collections; ! namespace NHibernate.Mapping { ! public class Component : Value { private ArrayList properties = new ArrayList(); --- 1,9 ---- using System; using System.Collections; ! namespace NHibernate.Mapping { ! /// <summary></summary> ! public class Component : Value { private ArrayList properties = new ArrayList(); *************** *** 15,57 **** private PersistentClass owner; ! public int PropertySpan { get { return properties.Count; } } ! public ICollection PropertyCollection { get { return properties; } } ! public void AddProperty(Property p) { ! properties.Add(p); } ! public override void AddColumn(Column column) { ! throw new NotSupportedException("Cant add a column to a component"); } ! public override int ColumnSpan { ! get { ! int n=0; ! foreach(Property p in PropertyCollection) { ! n+= p.ColumnSpan; } return n; } } ! ! public override ICollection ColumnCollection { ! get { ArrayList retVal = new ArrayList(); ! foreach(Property prop in PropertyCollection) { ! retVal.AddRange(prop.ColumnCollection); } return retVal; --- 15,71 ---- private PersistentClass owner; ! /// <summary></summary> ! public int PropertySpan { get { return properties.Count; } } ! /// <summary></summary> ! public ICollection PropertyCollection { get { return properties; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="p"></param> ! public void AddProperty( Property p ) { ! properties.Add( p ); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="column"></param> ! public override void AddColumn( Column column ) { ! throw new NotSupportedException( "Cant add a column to a component" ); } ! /// <summary></summary> ! public override int ColumnSpan { ! get { ! int n = 0; ! foreach( Property p in PropertyCollection ) { ! n += p.ColumnSpan; } return n; } } ! ! /// <summary></summary> ! public override ICollection ColumnCollection ! { ! get { ArrayList retVal = new ArrayList(); ! foreach( Property prop in PropertyCollection ) ! { ! retVal.AddRange( prop.ColumnCollection ); } return retVal; *************** *** 59,77 **** } ! public Component(PersistentClass owner) : base(owner.Table) { this.owner = owner; } ! public Component(Table table) : base(table) { this.owner = null; } ! public override void SetTypeByReflection(System.Type propertyClass, string propertyName) { } ! public bool IsEmbedded { get { return embedded; } --- 73,105 ---- } ! /// <summary> ! /// ! /// </summary> ! /// <param name="owner"></param> ! public Component( PersistentClass owner ) : base( owner.Table ) { this.owner = owner; } ! /// <summary> ! /// ! /// </summary> ! /// <param name="table"></param> ! public Component( Table table ) : base( table ) { this.owner = null; } ! /// <summary> ! /// ! /// </summary> ! /// <param name="propertyClass"></param> ! /// <param name="propertyName"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName ) { } ! /// <summary></summary> ! public bool IsEmbedded { get { return embedded; } *************** *** 79,88 **** } ! public override bool IsComposite { get { return true; } } ! public System.Type ComponentClass { get { return componentClass; } --- 107,118 ---- } ! /// <summary></summary> ! public override bool IsComposite { get { return true; } } ! /// <summary></summary> ! public System.Type ComponentClass { get { return componentClass; } *************** *** 90,94 **** } ! public PersistentClass Owner { get { return owner; } --- 120,125 ---- } ! /// <summary></summary> ! public PersistentClass Owner { get { return owner; } *************** *** 96,100 **** } ! public string ParentProperty { get { return parentProperty; } --- 127,132 ---- } ! /// <summary></summary> ! public string ParentProperty { get { return parentProperty; } *************** *** 102,106 **** } ! public ArrayList Properties { get { return properties; } --- 134,139 ---- } ! /// <summary></summary> ! public ArrayList Properties { get { return properties; } *************** *** 109,111 **** } ! } --- 142,144 ---- } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 21:26:36
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31814 Modified Files: Any.cs Array.cs Association.cs Bag.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: Any.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Any.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Any.cs 13 Apr 2004 02:06:54 -0000 1.4 --- Any.cs 31 Dec 2004 21:26:25 -0000 1.5 *************** *** 1,8 **** using System; - using NHibernate.Type; namespace NHibernate.Mapping { public class Any : Value { --- 1,8 ---- using System; using NHibernate.Type; namespace NHibernate.Mapping { + /// <summary></summary> public class Any : Value { *************** *** 10,18 **** private IType metaType = TypeFactory.GetTypeType(); ! public Any(Table table) : base(table) { } ! public override bool IsAny { get { return true; } --- 10,23 ---- private IType metaType = TypeFactory.GetTypeType(); ! /// <summary> ! /// ! /// </summary> ! /// <param name="table"></param> ! public Any( Table table ) : base( table ) { } ! /// <summary></summary> ! public override bool IsAny { get { return true; } *************** *** 22,26 **** /// Get or set the identifier type /// </summary> ! public virtual IType IdentifierType { get { return identifierType; } --- 27,31 ---- /// Get or set the identifier type /// </summary> ! public virtual IType IdentifierType { get { return identifierType; } *************** *** 28,43 **** } ! public override IType Type { ! get { return new ObjectType(metaType, identifierType); } ! set { throw new NotSupportedException("cannot set type of an Any"); } } ! public override void SetTypeByReflection(System.Type propertyClass, string propertyName) {} /// <summary> /// Get or set the metatype /// </summary> ! public virtual IType MetaType { get { return metaType; } --- 33,56 ---- } ! /// <summary></summary> ! public override IType Type { ! get { return new ObjectType( metaType, identifierType ); } ! set { throw new NotSupportedException( "cannot set type of an Any" ); } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="propertyClass"></param> ! /// <param name="propertyName"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName ) ! { ! } /// <summary> /// Get or set the metatype /// </summary> ! public virtual IType MetaType { get { return metaType; } Index: Bag.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Bag.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Bag.cs 13 Apr 2004 02:06:54 -0000 1.4 --- Bag.cs 31 Dec 2004 21:26:26 -0000 1.5 *************** *** 1,3 **** - using System; using NHibernate.Type; using NHibernateBag=NHibernate.Collection.Bag; --- 1,2 ---- *************** *** 10,27 **** public class Bag : Collection { ! public Bag(PersistentClass owner) : base(owner) { } ! public override PersistentCollectionType Type { ! get { return TypeFactory.Bag( Role );} } ! ! public override System.Type WrapperClass { ! get { return typeof(NHibernateBag); } } } ! } --- 9,32 ---- public class Bag : Collection { ! /// <summary> ! /// ! /// </summary> ! /// <param name="owner"></param> ! public Bag( PersistentClass owner ) : base( owner ) { } ! /// <summary></summary> ! public override PersistentCollectionType Type { ! get { return TypeFactory.Bag( Role ); } } ! ! /// <summary></summary> ! public override System.Type WrapperClass { ! get { return typeof( NHibernateBag ); } } } ! } \ No newline at end of file Index: Association.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Association.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Association.cs 13 Apr 2004 02:06:54 -0000 1.3 --- Association.cs 31 Dec 2004 21:26:26 -0000 1.4 *************** *** 1,15 **** - using System; using NHibernate.Loader; ! namespace NHibernate.Mapping { ! ! public abstract class Association : Value { private OuterJoinLoaderType joinedFetch; ! protected Association(Table table) : base(table) {} ! public override OuterJoinLoaderType OuterJoinFetchSetting { get { return joinedFetch; } --- 1,21 ---- using NHibernate.Loader; ! namespace NHibernate.Mapping { ! /// <summary></summary> ! public abstract class Association : Value { private OuterJoinLoaderType joinedFetch; ! /// <summary> ! /// ! /// </summary> ! /// <param name="table"></param> ! protected Association( Table table ) : base( table ) ! { ! } ! /// <summary></summary> ! public override OuterJoinLoaderType OuterJoinFetchSetting { get { return joinedFetch; } *************** *** 17,23 **** } ! public abstract override void SetTypeByReflection(System.Type propertyClass, string propertyName); public abstract override void CreateForeignKey(); } ! } --- 23,36 ---- } ! /// <summary> ! /// ! /// </summary> ! /// <param name="propertyClass"></param> ! /// <param name="propertyName"></param> ! public abstract override void SetTypeByReflection( System.Type propertyClass, string propertyName ); ! ! /// <summary></summary> public abstract override void CreateForeignKey(); } ! } \ No newline at end of file Index: Array.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Array.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Array.cs 13 Apr 2004 02:06:54 -0000 1.3 --- Array.cs 31 Dec 2004 21:26:26 -0000 1.4 *************** *** 1,18 **** ! using System; using NHibernate.Type; - using ArrayHolder=NHibernate.Collection.ArrayHolder; ! namespace NHibernate.Mapping { /// <summary> /// An array has a primary key consisting of the key columns + index column /// </summary> ! public class Array : List { private System.Type elementClass; ! public Array(PersistentClass owner) : base(owner) { } ! public System.Type ElementClass { get { return elementClass; } --- 1,24 ---- ! using NHibernate.Collection; using NHibernate.Type; ! namespace NHibernate.Mapping { /// <summary> /// An array has a primary key consisting of the key columns + index column /// </summary> ! public class Array : List { private System.Type elementClass; ! /// <summary> ! /// ! /// </summary> ! /// <param name="owner"></param> ! public Array( PersistentClass owner ) : base( owner ) ! { ! } ! /// <summary></summary> ! public System.Type ElementClass { get { return elementClass; } *************** *** 20,33 **** } ! public override PersistentCollectionType Type { get { return TypeFactory.Array( Role, ElementClass ); } } ! public override System.Type WrapperClass { ! get { return typeof(ArrayHolder); } } ! public override bool IsArray { get { return true; } --- 26,43 ---- } ! /// <summary></summary> ! public override PersistentCollectionType Type { get { return TypeFactory.Array( Role, ElementClass ); } } ! /// <summary></summary> ! public override System.Type WrapperClass { ! get { return typeof( ArrayHolder ); } } ! ! /// <summary></summary> ! public override bool IsArray { get { return true; } *************** *** 36,38 **** } ! } --- 46,48 ---- } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 20:58:09
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26346 Modified Files: Loader.cs OneToManyLoader.cs OuterJoinLoader.cs SimpleEntityLoader.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: OuterJoinLoader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/OuterJoinLoader.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** OuterJoinLoader.cs 22 Nov 2004 03:53:07 -0000 1.16 --- OuterJoinLoader.cs 31 Dec 2004 20:57:56 -0000 1.17 *************** *** 1,9 **** using System; using System.Collections; - using System.Data; using System.Text; - using NHibernate.Collection; - using NHibernate.Dialect; using NHibernate.Engine; using NHibernate.Persister; --- 1,6 ---- *************** *** 12,41 **** using NHibernate.Util; ! namespace NHibernate.Loader { ! ! public enum OuterJoinLoaderType { ! Lazy = -1, Auto = 0, Eager = 1 } ! ! public class OuterJoinLoader : Loader { ! ! protected static readonly IType[] NoTypes = new IType[0]; ! protected static readonly string[][] NoStringArrays = new string[0][]; ! protected static readonly string[] NoStrings = new string[0]; ! protected static readonly ILoadable[] NoPersisters = new ILoadable[0]; ! ! private ILoadable[] classPersisters; ! private LockMode[] lockModeArray; ! private SqlString sqlString; ! private string[] suffixes; ! ! public OuterJoinLoader(Dialect.Dialect dialect) : base(dialect) { } --- 9,51 ---- using NHibernate.Util; ! namespace NHibernate.Loader { ! /// <summary></summary> ! public enum OuterJoinLoaderType { ! /// <summary></summary> ! Lazy = -1, ! /// <summary></summary> Auto = 0, + /// <summary></summary> Eager = 1 } ! ! /// <summary></summary> ! public class OuterJoinLoader : Loader { ! /// <summary></summary> ! protected static readonly IType[ ] NoTypes = new IType[0]; ! ! /// <summary></summary> ! protected static readonly string[ ][ ] NoStringArrays = new string[0][ ]; ! ! /// <summary></summary> ! protected static readonly string[ ] NoStrings = new string[0]; ! ! /// <summary></summary> ! protected static readonly ILoadable[ ] NoPersisters = new ILoadable[0]; ! ! private ILoadable[ ] classPersisters; ! private LockMode[ ] lockModeArray; ! private SqlString sqlString; ! private string[ ] suffixes; ! /// <summary> ! /// ! /// </summary> ! /// <param name="dialect"></param> ! public OuterJoinLoader( Dialect.Dialect dialect ) : base( dialect ) { } *************** *** 49,59 **** /// <param name="foreignKeyColumns"></param> /// <returns></returns> ! protected virtual bool EnableJoinedFetch(bool mappingDefault, string path, string table, string[] foreignKeyColumns) { return mappingDefault; } ! public sealed class OuterJoinableAssociation { public ILoadable Subpersister; ! public string[] ForeignKeyColumns; public string Subalias; } --- 59,75 ---- /// <param name="foreignKeyColumns"></param> /// <returns></returns> ! protected virtual bool EnableJoinedFetch( bool mappingDefault, string path, string table, string[ ] foreignKeyColumns ) ! { return mappingDefault; } ! /// <summary></summary> ! public sealed class OuterJoinableAssociation // struct? ! { ! /// <summary></summary> public ILoadable Subpersister; ! /// <summary></summary> ! public string[ ] ForeignKeyColumns; ! /// <summary></summary> public string Subalias; } *************** *** 66,73 **** /// <param name="session"></param> /// <returns></returns> ! public IList WalkTree(ILoadable persister, string alias, ISessionFactoryImplementor session) { IList associations = new ArrayList(); ! WalkClassTree(persister, alias, associations, new ArrayList(), String.Empty, session); return associations; } --- 82,89 ---- /// <param name="session"></param> /// <returns></returns> ! public IList WalkTree( ILoadable persister, string alias, ISessionFactoryImplementor session ) { IList associations = new ArrayList(); ! WalkClassTree( persister, alias, associations, new ArrayList(), String.Empty, session ); return associations; } *************** *** 80,103 **** /// <param name="session"></param> /// <returns></returns> ! protected IList WalkCollectionTree(CollectionPersister persister, string alias, ISessionFactoryImplementor session) { IList associations = new ArrayList(); ! if ( session.EnableJoinedFetch ) { IType type = persister.ElementType; ! if (type.IsEntityType) { ! EntityType etype = (EntityType) type; // we do NOT need to call this.EnableJoinedFetch() here ! if ( AutoEager( persister.EnableJoinFetch, etype, session) ) { ! string[] columns = StringHelper.Prefix( persister.ElementColumnNames, alias + StringHelper.Dot); ! WalkAssociationTree(etype, columns, persister, alias, associations, new ArrayList(), String.Empty, session); } ! } ! else if (type.IsComponentType) { ! WalkCompositeElementTree( (IAbstractComponentType) type, persister.ElementColumnNames, persister, alias, associations, new ArrayList(), String.Empty, session); } } --- 96,119 ---- /// <param name="session"></param> /// <returns></returns> ! protected IList WalkCollectionTree( CollectionPersister persister, string alias, ISessionFactoryImplementor session ) { IList associations = new ArrayList(); ! if( session.EnableJoinedFetch ) { IType type = persister.ElementType; ! if( type.IsEntityType ) { ! EntityType etype = ( EntityType ) type; // we do NOT need to call this.EnableJoinedFetch() here ! if( AutoEager( persister.EnableJoinFetch, etype, session ) ) { ! string[ ] columns = StringHelper.Prefix( persister.ElementColumnNames, alias + StringHelper.Dot ); ! WalkAssociationTree( etype, columns, persister, alias, associations, new ArrayList(), String.Empty, session ); } ! } ! else if( type.IsComponentType ) { ! WalkCompositeElementTree( ( IAbstractComponentType ) type, persister.ElementColumnNames, persister, alias, associations, new ArrayList(), String.Empty, session ); } } *************** *** 119,123 **** private void WalkAssociationTree( EntityType type, ! string[] columns, object persister, string alias, --- 135,139 ---- private void WalkAssociationTree( EntityType type, ! string[ ] columns, object persister, string alias, *************** *** 125,147 **** IList classPersisters, string path, ! ISessionFactoryImplementor session) { ! ! ILoadable subpersister = (ILoadable)session.GetPersister(type.PersistentClass); // to avoid navigating back up bidirectional associations (and circularities) ! if(!classPersisters.Contains(subpersister)) { OuterJoinableAssociation assoc = new OuterJoinableAssociation(); ! associations.Add(assoc); ! classPersisters.Add(persister); assoc.Subpersister = subpersister; assoc.ForeignKeyColumns = columns; ! string subalias = ToAlias(subpersister.ClassName, associations.Count); assoc.Subalias = subalias; ! WalkClassTree(subpersister, subalias, associations, classPersisters, path, session); ! } ! } --- 141,163 ---- IList classPersisters, string path, ! ISessionFactoryImplementor session ) { ! ILoadable subpersister = ( ILoadable ) session.GetPersister( type.PersistentClass ); // to avoid navigating back up bidirectional associations (and circularities) ! if( !classPersisters.Contains( subpersister ) ) ! { OuterJoinableAssociation assoc = new OuterJoinableAssociation(); ! associations.Add( assoc ); ! classPersisters.Add( persister ); assoc.Subpersister = subpersister; assoc.ForeignKeyColumns = columns; ! string subalias = ToAlias( subpersister.ClassName, associations.Count ); assoc.Subalias = subalias; ! WalkClassTree( subpersister, subalias, associations, classPersisters, path, session ); ! } ! } *************** *** 157,161 **** /// <param name="path"></param> /// <param name="session"></param> ! private void WalkAssociationTree ( EntityType etype, ILoadable persister, --- 173,177 ---- /// <param name="path"></param> /// <param name="session"></param> ! private void WalkAssociationTree( EntityType etype, ILoadable persister, *************** *** 165,188 **** IList classPersisters, string path, ! ISessionFactoryImplementor session) { ! ! bool autoEager = AutoEager(persister.EnableJoinedFetch(propertyNumber), etype, session); ! string[] columns; ! if(etype.IsOneToOne) { //TODO: NOTE: workaround for problem with 1-to-1 defined on a subclass "accidently" picking up an object ! if(persister.IsDefinedOnSubclass(propertyNumber)) return; columns = StringHelper.Prefix( persister.IdentifierColumnNames, //The cast is safe because collections can't contain a 1-to-1 ! alias + StringHelper.Dot); } ! else { ! columns = persister.ToColumns(alias, propertyNumber); } - - string subpath = SubPath(path, persister.GetSubclassPropertyName(propertyNumber)); - bool enable = EnableJoinedFetch(autoEager, subpath, persister.GetSubclassPropertyTableName(propertyNumber), persister.GetSubclassPropertyColumnNames(propertyNumber) ); - if (enable) WalkAssociationTree(etype, columns, persister, alias, associations, classPersisters, subpath, session); } --- 181,212 ---- IList classPersisters, string path, ! ISessionFactoryImplementor session ) ! { ! bool autoEager = AutoEager( persister.EnableJoinedFetch( propertyNumber ), etype, session ); ! string[ ] columns; ! if( etype.IsOneToOne ) ! { //TODO: NOTE: workaround for problem with 1-to-1 defined on a subclass "accidently" picking up an object ! if( persister.IsDefinedOnSubclass( propertyNumber ) ) ! { ! return; ! } columns = StringHelper.Prefix( persister.IdentifierColumnNames, //The cast is safe because collections can't contain a 1-to-1 ! alias + StringHelper.Dot ); } ! else ! { ! columns = persister.ToColumns( alias, propertyNumber ); ! } ! ! string subpath = SubPath( path, persister.GetSubclassPropertyName( propertyNumber ) ); ! bool enable = EnableJoinedFetch( autoEager, subpath, persister.GetSubclassPropertyTableName( propertyNumber ), persister.GetSubclassPropertyColumnNames( propertyNumber ) ); ! if( enable ) ! { ! WalkAssociationTree( etype, columns, persister, alias, associations, classPersisters, subpath, session ); } } *************** *** 197,211 **** /// <param name="path"></param> /// <param name="session"></param> ! private void WalkClassTree(ILoadable persister, string alias, IList associations, IList classPersisters, string path, ISessionFactoryImplementor session) { ! if ( !session.EnableJoinedFetch ) return; int n = persister.CountSubclassProperties(); ! for (int i=0; i<n; i++) { ! IType type = persister.GetSubclassPropertyType(i); ! if (type.IsEntityType) { ! WalkAssociationTree ( ! (EntityType)type, persister, i, --- 221,239 ---- /// <param name="path"></param> /// <param name="session"></param> ! private void WalkClassTree( ILoadable persister, string alias, IList associations, IList classPersisters, string path, ISessionFactoryImplementor session ) { ! if( !session.EnableJoinedFetch ) ! { ! return; ! } int n = persister.CountSubclassProperties(); ! for( int i = 0; i < n; i++ ) { ! IType type = persister.GetSubclassPropertyType( i ); ! if( type.IsEntityType ) ! { ! WalkAssociationTree( ! ( EntityType ) type, persister, i, *************** *** 215,239 **** path, session ! ); ! ! } ! else if ( type.IsComponentType ) { ! string subpath = SubPath(path, persister.GetSubclassPropertyName(i) ); ! string[] columns = persister.GetSubclassPropertyColumnNames(i); ! string[] aliasedColumns = persister.ToColumns(alias, i); ! WalkComponentTree( ! (IAbstractComponentType) type, ! i, ! columns, aliasedColumns, ! persister, ! alias, ! associations, ! classPersisters, ! subpath, session ! ); } } --- 243,267 ---- path, session ! ); ! ! } ! else if( type.IsComponentType ) { ! string subpath = SubPath( path, persister.GetSubclassPropertyName( i ) ); ! string[ ] columns = persister.GetSubclassPropertyColumnNames( i ); ! string[ ] aliasedColumns = persister.ToColumns( alias, i ); ! WalkComponentTree( ! ( IAbstractComponentType ) type, ! i, ! columns, aliasedColumns, ! persister, ! alias, ! associations, ! classPersisters, ! subpath, session ! ); } } *************** *** 247,301 **** /// <param name="persister"></param> /// <param name="alias"></param> ! /// <param name="assocaitions"></param> /// <param name="classPersisters"></param> /// <param name="session"></param> private void WalkComponentTree( ! IAbstractComponentType act, ! int propertyNumber, ! string[] cols, ! string[] aliasedCols, ! ILoadable persister, ! string alias, ! IList associations, ! IList classPersisters, string path, ! ISessionFactoryImplementor session) { ! if (!session.EnableJoinedFetch ) return; ! ! IType[] types = act.Subtypes; ! string[] propertyNames = act.PropertyNames; int begin = 0; ! for (int i=0; i<types.Length; i++) { ! int length = types[i].GetColumnSpan(session); ! string[] range = ArrayHelper.Slice(cols, begin, length); ! string[] aliasedRange = ArrayHelper.Slice(aliasedCols, begin, length); ! if ( types[i].IsEntityType ) { ! EntityType etype = (EntityType) types[i]; ! //TODO: workaround for problem with 1-to-1 defined on a subclass ! if (etype.IsOneToOne) continue; ! ! string subpath = SubPath(path, propertyNames[i]); ! bool autoEager = AutoEager(act.EnableJoinedFetch(i), etype, session); ! ! bool enable = EnableJoinedFetch(autoEager, subpath, persister.GetSubclassPropertyTableName(propertyNumber), range); ! ! if(enable) ! WalkAssociationTree(etype, aliasedRange, persister, alias, associations, classPersisters, subpath, session); ! } ! else if ( types[i].IsComponentType ) { ! string subpath = SubPath(path, propertyNames[i]); ! WalkComponentTree ( (IAbstractComponentType) types[i], propertyNumber, range, aliasedRange, persister, alias, associations, classPersisters, subpath, session); } ! begin+=length; } } --- 275,339 ---- /// <param name="persister"></param> /// <param name="alias"></param> ! /// <param name="associations"></param> /// <param name="classPersisters"></param> /// <param name="session"></param> + /// <param name="aliasedCols"></param> + /// <param name="path"></param> + /// <param name="propertyNumber"></param> private void WalkComponentTree( ! IAbstractComponentType act, ! int propertyNumber, ! string[ ] cols, ! string[ ] aliasedCols, ! ILoadable persister, ! string alias, ! IList associations, ! IList classPersisters, string path, ! ISessionFactoryImplementor session ) { + if( !session.EnableJoinedFetch ) + { + return; + } ! IType[ ] types = act.Subtypes; ! string[ ] propertyNames = act.PropertyNames; int begin = 0; ! for( int i = 0; i < types.Length; i++ ) { ! int length = types[ i ].GetColumnSpan( session ); ! string[ ] range = ArrayHelper.Slice( cols, begin, length ); ! string[ ] aliasedRange = ArrayHelper.Slice( aliasedCols, begin, length ); ! if( types[ i ].IsEntityType ) { ! EntityType etype = ( EntityType ) types[ i ]; ! //TODO: workaround for problem with 1-to-1 defined on a subclass ! if( etype.IsOneToOne ) ! { ! continue; ! } ! string subpath = SubPath( path, propertyNames[ i ] ); ! bool autoEager = AutoEager( act.EnableJoinedFetch( i ), etype, session ); ! ! bool enable = EnableJoinedFetch( autoEager, subpath, persister.GetSubclassPropertyTableName( propertyNumber ), range ); ! ! if( enable ) ! { ! WalkAssociationTree( etype, aliasedRange, persister, alias, associations, classPersisters, subpath, session ); ! } ! ! } ! else if( types[ i ].IsComponentType ) { ! string subpath = SubPath( path, propertyNames[ i ] ); ! WalkComponentTree( ( IAbstractComponentType ) types[ i ], propertyNumber, range, aliasedRange, persister, alias, associations, classPersisters, subpath, session ); } ! begin += length; } } *************** *** 312,318 **** /// <param name="path"></param> /// <param name="session"></param> ! private void WalkCompositeElementTree ( IAbstractComponentType act, ! string[] cols, CollectionPersister persister, string alias, --- 350,356 ---- /// <param name="path"></param> /// <param name="session"></param> ! private void WalkCompositeElementTree( IAbstractComponentType act, ! string[ ] cols, CollectionPersister persister, string alias, *************** *** 320,354 **** IList classPersisters, string path, ! ISessionFactoryImplementor session ) { ! if(!session.EnableJoinedFetch) return; ! IType[] types = act.Subtypes; ! string[] propertyNames = act.PropertyNames; int begin = 0; ! for(int i=0; i < types.Length; i++) { ! int length = types[i].GetColumnSpan(session); ! string[] range = ArrayHelper.Slice(cols, begin, length); ! ! if(types[i].IsEntityType) { ! EntityType etype = (EntityType) types[i]; ! string subpath = SubPath(path, propertyNames[i]); ! bool autoEager = AutoEager(act.EnableJoinedFetch(i), etype, session ); ! bool enable = EnableJoinedFetch(autoEager, subpath, persister.QualifiedTableName, range); ! if(enable) { ! string[] columns = StringHelper.Prefix(range, alias + StringHelper.Dot); ! WalkAssociationTree(etype, columns, persister, alias, associations, classPersisters, subpath, session); } } ! else if(types[i].IsComponentType) { ! string subpath = SubPath(path, propertyNames[i]); WalkCompositeElementTree( ! (IAbstractComponentType) types[i], range, persister, --- 358,395 ---- IList classPersisters, string path, ! ISessionFactoryImplementor session ) { ! if( !session.EnableJoinedFetch ) ! { ! return; ! } ! IType[ ] types = act.Subtypes; ! string[ ] propertyNames = act.PropertyNames; int begin = 0; ! for( int i = 0; i < types.Length; i++ ) { ! int length = types[ i ].GetColumnSpan( session ); ! string[ ] range = ArrayHelper.Slice( cols, begin, length ); ! ! if( types[ i ].IsEntityType ) { ! EntityType etype = ( EntityType ) types[ i ]; ! string subpath = SubPath( path, propertyNames[ i ] ); ! bool autoEager = AutoEager( act.EnableJoinedFetch( i ), etype, session ); ! bool enable = EnableJoinedFetch( autoEager, subpath, persister.QualifiedTableName, range ); ! if( enable ) { ! string[ ] columns = StringHelper.Prefix( range, alias + StringHelper.Dot ); ! WalkAssociationTree( etype, columns, persister, alias, associations, classPersisters, subpath, session ); } } ! else if( types[ i ].IsComponentType ) { ! string subpath = SubPath( path, propertyNames[ i ] ); WalkCompositeElementTree( ! ( IAbstractComponentType ) types[ i ], range, persister, *************** *** 358,379 **** subpath, session ! ); ! } ! begin+=length; } - - } ! protected bool AutoEager(OuterJoinLoaderType config, EntityType type, ISessionFactoryImplementor session) { ! if (config==OuterJoinLoaderType.Eager) return true; ! if (config==OuterJoinLoaderType.Lazy) return false; IClassPersister persister = session.GetPersister( type.PersistentClass ); ! return !persister.HasProxy || ( type.IsOneToOne && ((OneToOneType) type).IsNullable ); } ! protected internal override SqlString SqlString { get { return sqlString; } --- 399,433 ---- subpath, session ! ); ! } ! begin += length; } + } ! /// <summary> ! /// ! /// </summary> ! /// <param name="config"></param> ! /// <param name="type"></param> ! /// <param name="session"></param> ! /// <returns></returns> ! protected bool AutoEager( OuterJoinLoaderType config, EntityType type, ISessionFactoryImplementor session ) { ! if( config == OuterJoinLoaderType.Eager ) ! { ! return true; ! } ! if( config == OuterJoinLoaderType.Lazy ) ! { ! return false; ! } IClassPersister persister = session.GetPersister( type.PersistentClass ); ! return !persister.HasProxy || ( type.IsOneToOne && ( ( OneToOneType ) type ).IsNullable ); } ! /// <summary></summary> ! protected internal override SqlString SqlString { get { return sqlString; } *************** *** 381,391 **** } ! protected override ILoadable[] Persisters { ! get { return classPersisters; } set { classPersisters = value; } } ! protected LockMode[] LockModeArray { get { return lockModeArray; } --- 435,447 ---- } ! /// <summary></summary> ! protected override ILoadable[ ] Persisters { ! get { return classPersisters; } set { classPersisters = value; } } ! /// <summary></summary> ! protected LockMode[ ] LockModeArray { get { return lockModeArray; } *************** *** 398,408 **** /// <param name="associations"></param> /// <returns></returns> ! public string SelectString(IList associations) { ! StringBuilder buf = new StringBuilder( associations.Count * 100 ); ! for (int i=0; i<associations.Count; i++) { ! OuterJoinableAssociation join = (OuterJoinableAssociation) associations[i]; ! AppendSelectString( buf, join.Subpersister, join.Subalias, Suffixes[i] ); ! if ( i<associations.Count-1) buf.Append(StringHelper.CommaSpace); } return buf.ToString(); --- 454,468 ---- /// <param name="associations"></param> /// <returns></returns> ! public string SelectString( IList associations ) ! { ! StringBuilder buf = new StringBuilder( associations.Count*100 ); ! for( int i = 0; i < associations.Count; i++ ) { ! OuterJoinableAssociation join = ( OuterJoinableAssociation ) associations[ i ]; ! AppendSelectString( buf, join.Subpersister, join.Subalias, Suffixes[ i ] ); ! if( i < associations.Count - 1 ) ! { ! buf.Append( StringHelper.CommaSpace ); ! } } return buf.ToString(); *************** *** 416,423 **** /// <param name="suffix"></param> /// <returns></returns> ! protected static string SelectString(ILoadable persister, string alias, string suffix) { ! StringBuilder buf = new StringBuilder(30); ! AppendSelectString(buf, persister, alias, suffix); return buf.ToString(); } --- 476,483 ---- /// <param name="suffix"></param> /// <returns></returns> ! protected static string SelectString( ILoadable persister, string alias, string suffix ) { ! StringBuilder buf = new StringBuilder( 30 ); ! AppendSelectString( buf, persister, alias, suffix ); return buf.ToString(); } *************** *** 430,442 **** /// <param name="alias"></param> /// <param name="suffix"></param> ! private static void AppendSelectString(StringBuilder buf, ILoadable persister, string alias, string suffix) { // doing a ToString is okay because SelectFragments will have no parameters // and will be just straight strings cotaining sql. ! buf.Append( persister.IdentifierSelectFragment(alias,suffix).ToString() ) ! .Append( persister.PropertySelectFragment(alias, suffix).ToString() ); } ! protected override string[] Suffixes { get { return suffixes; } --- 490,503 ---- /// <param name="alias"></param> /// <param name="suffix"></param> ! private static void AppendSelectString( StringBuilder buf, ILoadable persister, string alias, string suffix ) { // doing a ToString is okay because SelectFragments will have no parameters // and will be just straight strings cotaining sql. ! buf.Append( persister.IdentifierSelectFragment( alias, suffix ).ToString() ) ! .Append( persister.PropertySelectFragment( alias, suffix ).ToString() ); } ! /// <summary></summary> ! protected override string[ ] Suffixes { get { return suffixes; } *************** *** 444,460 **** } ! protected string ToAlias(string tableName, int n) { // H2.0.3 - was called Alias, but changed it to ToAlias because I wanted to have // a protected property named Alias ! //TODO: this is broken if we have quoted identifier with a "." ! tableName = StringHelper.Unqualify(tableName); //TODO: H2.0.3 - changes tableName to lower case - don't know why it is needed... ! return ( new Alias(10, n.ToString() + StringHelper.Underscore) ).ToAliasString( tableName, Dialect ); } ! protected override CollectionPersister CollectionPersister { get { return null; } --- 505,528 ---- } ! /// <summary> ! /// ! /// </summary> ! /// <param name="tableName"></param> ! /// <param name="n"></param> ! /// <returns></returns> ! protected string ToAlias( string tableName, int n ) { // H2.0.3 - was called Alias, but changed it to ToAlias because I wanted to have // a protected property named Alias ! //TODO: this is broken if we have quoted identifier with a "." ! tableName = StringHelper.Unqualify( tableName ); //TODO: H2.0.3 - changes tableName to lower case - don't know why it is needed... ! return ( new Alias( 10, n.ToString() + StringHelper.Underscore ) ).ToAliasString( tableName, Dialect ); } ! /// <summary></summary> ! protected override CollectionPersister CollectionPersister { get { return null; } *************** *** 466,473 **** /// <param name="associations"></param> /// <returns></returns> ! public JoinFragment OuterJoins(IList associations) { JoinFragment outerjoin = Dialect.CreateOuterJoinFragment(); ! foreach(OuterJoinLoader.OuterJoinableAssociation oj in associations) { outerjoin.AddJoin( --- 534,541 ---- /// <param name="associations"></param> /// <returns></returns> ! public JoinFragment OuterJoins( IList associations ) { JoinFragment outerjoin = Dialect.CreateOuterJoinFragment(); ! foreach( OuterJoinableAssociation oj in associations ) { outerjoin.AddJoin( *************** *** 478,485 **** JoinType.LeftOuterJoin ); ! outerjoin.AddJoins( ! oj.Subpersister.FromJoinFragment(oj.Subalias, false, true), ! oj.Subpersister.WhereJoinFragment(oj.Subalias, false, true) ); } --- 546,553 ---- JoinType.LeftOuterJoin ); ! outerjoin.AddJoins( ! oj.Subpersister.FromJoinFragment( oj.Subalias, false, true ), ! oj.Subpersister.WhereJoinFragment( oj.Subalias, false, true ) ); } *************** *** 487,517 **** } ! protected override LockMode[] GetLockModes(IDictionary lockModes) { return lockModeArray; } ! protected LockMode[] CreateLockModeArray(int length, LockMode lockMode) { ! LockMode[] lmArray = new LockMode[length]; ! for(int i = 0 ; i < length; i++) { ! lmArray[i] = lockMode; } return lmArray; } ! private string SubPath(string path, string property) { ! if(path==null || path.Length==0) { return property; } ! else { return path + StringHelper.Dot + property; } } ! } ! } --- 555,596 ---- } ! /// <summary> ! /// ! /// </summary> ! /// <param name="lockModes"></param> ! /// <returns></returns> ! protected override LockMode[ ] GetLockModes( IDictionary lockModes ) { return lockModeArray; } ! /// <summary> ! /// ! /// </summary> ! /// <param name="length"></param> ! /// <param name="lockMode"></param> ! /// <returns></returns> ! protected LockMode[ ] CreateLockModeArray( int length, LockMode lockMode ) { ! LockMode[ ] lmArray = new LockMode[length]; ! for( int i = 0; i < length; i++ ) { ! lmArray[ i ] = lockMode; } return lmArray; } ! private string SubPath( string path, string property ) { ! if( path == null || path.Length == 0 ) { return property; } ! else { return path + StringHelper.Dot + property; } } ! } ! } \ No newline at end of file Index: OneToManyLoader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/OneToManyLoader.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** OneToManyLoader.cs 22 Nov 2004 03:53:07 -0000 1.12 --- OneToManyLoader.cs 31 Dec 2004 20:57:56 -0000 1.13 *************** *** 1,6 **** using System; - using System.Text; using System.Collections; - using NHibernate.Collection; using NHibernate.Engine; --- 1,4 ---- *************** *** 10,104 **** using NHibernate.Util; ! namespace NHibernate.Loader { /// <summary> /// Loads one-to-many associations /// </summary> ! public class OneToManyLoader : OuterJoinLoader, ICollectionInitializer { private CollectionPersister collectionPersister; private IType idType; ! ! protected override bool EnableJoinedFetch(bool mappingDefault, string path, string table, string[] foreignKeyColumns) { return mappingDefault && ( ! !table.Equals(collectionPersister.QualifiedTableName) || ! !ArrayHelper.Equals(foreignKeyColumns, collectionPersister.KeyColumnNames) ! ); } ! public OneToManyLoader(CollectionPersister collPersister, ISessionFactoryImplementor factory) : base ( factory.Dialect ) { collectionPersister = collPersister; idType = collectionPersister.KeyType; ! ILoadable persister = (ILoadable) factory.GetPersister( ! ((EntityType) collPersister.ElementType).PersistentClass); - string alias = ToAlias(collectionPersister.QualifiedTableName, 0); - SqlString whereSqlString = null; ! if (collectionPersister.HasWhere) ! whereSqlString = new SqlString(collectionPersister.GetSQLWhereString(alias)); ! ! IList associations = WalkTree(persister, alias, factory); ! int joins=associations.Count; ! Suffixes = new string[joins+1]; ! for (int i=0; i<=joins; i++) Suffixes[i] = (joins==0) ? String.Empty : i.ToString() + StringHelper.Underscore; ! JoinFragment ojf = OuterJoins(associations); - SqlSelectBuilder selectBuilder = new SqlSelectBuilder(factory); - selectBuilder.SetSelectClause( ! collectionPersister.SelectClauseFragment(alias) + ! (joins==0 ? String.Empty : "," + SelectString(associations) ) + ! ", " + ! SelectString( persister, alias, Suffixes[joins] ) ); selectBuilder.SetFromClause( ! persister.FromTableFragment(alias).Append( ! persister.FromJoinFragment(alias, true, true) ! ) ! ); ! selectBuilder.SetWhereClause(alias, collectionPersister.KeyColumnNames, collectionPersister.KeyType); ! if(collectionPersister.HasWhere) selectBuilder.AddWhereClause(whereSqlString); selectBuilder.SetOuterJoins( ojf.ToFromFragmentString, ojf.ToWhereFragmentString.Append( ! persister.WhereJoinFragment(alias, true, true) ! ) ! ); ! if(collectionPersister.HasOrdering) selectBuilder.SetOrderByClause( collectionPersister.GetSQLOrderByString(alias) ); this.SqlString = selectBuilder.ToSqlString(); ! Persisters = new ILoadable[joins+1]; ! LockModeArray = CreateLockModeArray(joins+1, LockMode.None); ! for (int i=0; i<joins; i++) { ! Persisters[i] = ((OuterJoinableAssociation) associations[i]).Subpersister; } ! Persisters[joins] = persister; ! PostInstantiate(); } ! protected override CollectionPersister CollectionPersister { get { return collectionPersister; } } ! public void Initialize(object id, PersistentCollection collection, object owner, ISessionImplementor session) { ! LoadCollection(session, id, idType, owner, collection); } } ! } --- 8,136 ---- using NHibernate.Util; ! namespace NHibernate.Loader { /// <summary> /// Loads one-to-many associations /// </summary> ! public class OneToManyLoader : OuterJoinLoader, ICollectionInitializer { private CollectionPersister collectionPersister; private IType idType; ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="mappingDefault"></param> ! /// <param name="path"></param> ! /// <param name="table"></param> ! /// <param name="foreignKeyColumns"></param> ! /// <returns></returns> ! protected override bool EnableJoinedFetch( bool mappingDefault, string path, string table, string[ ] foreignKeyColumns ) { return mappingDefault && ( ! !table.Equals( collectionPersister.QualifiedTableName ) || ! !ArrayHelper.Equals( foreignKeyColumns, collectionPersister.KeyColumnNames ) ! ); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="collPersister"></param> ! /// <param name="factory"></param> ! public OneToManyLoader( CollectionPersister collPersister, ISessionFactoryImplementor factory ) : base( factory.Dialect ) { collectionPersister = collPersister; idType = collectionPersister.KeyType; ! ILoadable persister = ( ILoadable ) factory.GetPersister( ! ( ( EntityType ) collPersister.ElementType ).PersistentClass ); ! ! string alias = ToAlias( collectionPersister.QualifiedTableName, 0 ); SqlString whereSqlString = null; ! if( collectionPersister.HasWhere ) ! { ! whereSqlString = new SqlString( collectionPersister.GetSQLWhereString( alias ) ); ! } ! IList associations = WalkTree( persister, alias, factory ); ! ! int joins = associations.Count; ! Suffixes = new string[joins + 1]; ! for( int i = 0; i <= joins; i++ ) ! { ! Suffixes[ i ] = ( joins == 0 ) ? String.Empty : i.ToString() + StringHelper.Underscore; ! } ! JoinFragment ojf = OuterJoins( associations ); ! ! SqlSelectBuilder selectBuilder = new SqlSelectBuilder( factory ); selectBuilder.SetSelectClause( ! collectionPersister.SelectClauseFragment( alias ) + ! ( joins == 0 ? String.Empty : "," + SelectString( associations ) ) + ! ", " + ! SelectString( persister, alias, Suffixes[ joins ] ) ); selectBuilder.SetFromClause( ! persister.FromTableFragment( alias ).Append( ! persister.FromJoinFragment( alias, true, true ) ! ) ! ); ! selectBuilder.SetWhereClause( alias, collectionPersister.KeyColumnNames, collectionPersister.KeyType ); ! if( collectionPersister.HasWhere ) ! { ! selectBuilder.AddWhereClause( whereSqlString ); ! } selectBuilder.SetOuterJoins( ojf.ToFromFragmentString, ojf.ToWhereFragmentString.Append( ! persister.WhereJoinFragment( alias, true, true ) ! ) ! ); ! if( collectionPersister.HasOrdering ) ! { ! selectBuilder.SetOrderByClause( collectionPersister.GetSQLOrderByString( alias ) ); ! } this.SqlString = selectBuilder.ToSqlString(); ! Persisters = new ILoadable[joins + 1]; ! LockModeArray = CreateLockModeArray( joins + 1, LockMode.None ); ! for( int i = 0; i < joins; i++ ) { ! Persisters[ i ] = ( ( OuterJoinableAssociation ) associations[ i ] ).Subpersister; } ! Persisters[ joins ] = persister; ! PostInstantiate(); } ! /// <summary></summary> ! protected override CollectionPersister CollectionPersister ! { get { return collectionPersister; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="id"></param> ! /// <param name="collection"></param> ! /// <param name="owner"></param> ! /// <param name="session"></param> ! public void Initialize( object id, PersistentCollection collection, object owner, ISessionImplementor session ) ! { ! LoadCollection( session, id, idType, owner, collection ); } } ! } \ No newline at end of file Index: Loader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/Loader.cs,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** Loader.cs 27 Dec 2004 03:53:52 -0000 1.44 --- Loader.cs 31 Dec 2004 20:57:56 -0000 1.45 *************** *** 2,6 **** using System.Collections; using System.Data; ! using NHibernate.Collection; using NHibernate.Engine; --- 2,6 ---- using System.Collections; using System.Data; ! using log4net; using NHibernate.Collection; [...1372 lines suppressed...] { int size = persister.PropertyNames.Length; ! string[ ][ ] result = new string[size][ ]; ! for( int i = 0; i < size; i++ ) { ! result[ i ] = new Alias( suffix ).ToUnquotedAliasStrings( persister.GetPropertyColumnNames( i ), dialect ); } return result; } ! private string GetDiscriminatorAliases( string suffix, ILoadable persister ) { return persister.HasSubclasses ? ! new Alias( suffix ).ToUnquotedAliasString( persister.DiscriminatorColumnName, dialect ) : null; } } ! } \ No newline at end of file Index: SimpleEntityLoader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/SimpleEntityLoader.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SimpleEntityLoader.cs 22 Nov 2004 03:53:07 -0000 1.9 --- SimpleEntityLoader.cs 31 Dec 2004 20:57:56 -0000 1.10 *************** *** 2,7 **** using System.Collections; using System.Data; - using System.Text; - using NHibernate.Collection; using NHibernate.Engine; --- 2,5 ---- *************** *** 9,38 **** using NHibernate.SqlCommand; using NHibernate.Type; - using NHibernate.Util; ! namespace NHibernate.Loader { /// <summary> /// Loads entity instances one instance per select (ie without outerjoin fetching) /// </summary> ! public class SimpleEntityLoader : Loader, IUniqueEntityLoader { ! private ILoadable[] persister; ! private IType[] idType; private SqlString sqlString; ! private LockMode[] lockMode; ! ! private string[] NoSuffix = new string[] { String.Empty }; ! public SimpleEntityLoader(ILoadable persister, SqlString sqlString, LockMode lockMode, Dialect.Dialect d) : base(d) { ! this.persister = new ILoadable[] { persister }; ! this.idType = new IType[] { persister.IdentifierType }; this.sqlString = sqlString; ! this.lockMode = new LockMode[] {lockMode}; PostInstantiate(); } ! protected internal override SqlString SqlString { get { return sqlString; } --- 7,43 ---- using NHibernate.SqlCommand; using NHibernate.Type; ! namespace NHibernate.Loader { /// <summary> /// Loads entity instances one instance per select (ie without outerjoin fetching) /// </summary> ! public class SimpleEntityLoader : Loader, IUniqueEntityLoader { ! private ILoadable[ ] persister; ! private IType[ ] idType; private SqlString sqlString; ! private LockMode[ ] lockMode; ! private string[ ] NoSuffix = new string[ ] {String.Empty}; ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="persister"></param> ! /// <param name="sqlString"></param> ! /// <param name="lockMode"></param> ! /// <param name="d"></param> ! public SimpleEntityLoader( ILoadable persister, SqlString sqlString, LockMode lockMode, Dialect.Dialect d ) : base( d ) { ! this.persister = new ILoadable[ ] {persister}; ! this.idType = new IType[ ] {persister.IdentifierType}; this.sqlString = sqlString; ! this.lockMode = new LockMode[ ] {lockMode}; PostInstantiate(); } ! /// <summary></summary> ! protected internal override SqlString SqlString { get { return sqlString; } *************** *** 40,44 **** } ! protected override ILoadable[] Persisters { get { return persister; } --- 45,50 ---- } ! /// <summary></summary> ! protected override ILoadable[ ] Persisters { get { return persister; } *************** *** 46,55 **** } ! protected override CollectionPersister CollectionPersister { get { return null; } } ! protected override string[] Suffixes { get { return NoSuffix; } --- 52,63 ---- } ! /// <summary></summary> ! protected override CollectionPersister CollectionPersister { get { return null; } } ! /// <summary></summary> ! protected override string[ ] Suffixes { get { return NoSuffix; } *************** *** 57,90 **** } ! public object Load(ISessionImplementor session, object id, object obj) { ! IList list = LoadEntity(session, new object[] { id }, idType, obj, id, false); ! if (list.Count==1) { ! return list[0]; //return ( (object[]) list[0] )[0]; ! } ! else if (list.Count==0) { return null; ! } ! else { ! throw new HibernateException("More than one row with the given identifier was found: " + id + ", for class: " + persister[0].ClassName ); } } ! protected override LockMode[] GetLockModes(IDictionary lockModes) { return lockMode; } protected override Object GetResultColumnOrRow( ! Object[] row, IDataReader rs, ! ISessionImplementor session) { ! ! return row[0]; } } ! } --- 65,118 ---- } ! /// <summary> ! /// ! /// </summary> ! /// <param name="session"></param> ! /// <param name="id"></param> ! /// <param name="obj"></param> ! /// <returns></returns> ! public object Load( ISessionImplementor session, object id, object obj ) { ! IList list = LoadEntity( session, new object[ ] {id}, idType, obj, id, false ); ! if( list.Count == 1 ) { ! return list[ 0 ]; //return ( (object[]) list[0] )[0]; ! } ! else if( list.Count == 0 ) { return null; ! } ! else { ! throw new HibernateException( "More than one row with the given identifier was found: " + id + ", for class: " + persister[ 0 ].ClassName ); } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="lockModes"></param> ! /// <returns></returns> ! protected override LockMode[ ] GetLockModes( IDictionary lockModes ) ! { return lockMode; } + /// <summary> + /// + /// </summary> + /// <param name="row"></param> + /// <param name="rs"></param> + /// <param name="session"></param> + /// <returns></returns> protected override Object GetResultColumnOrRow( ! Object[ ] row, IDataReader rs, ! ISessionImplementor session ) ! { ! return row[ 0 ]; } } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 20:57:54
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26279 Modified Files: EntityLoader.cs ICollectionInitializer.cs IUniqueEntityLoader.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: ICollectionInitializer.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/ICollectionInitializer.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ICollectionInitializer.cs 2 Apr 2004 15:55:48 -0000 1.2 --- ICollectionInitializer.cs 31 Dec 2004 20:57:44 -0000 1.3 *************** *** 1,14 **** - using System; using NHibernate.Collection; using NHibernate.Engine; ! namespace NHibernate.Loader { /// <summary> /// An interface for collection loaders /// </summary> ! public interface ICollectionInitializer { - /// <summary> /// Initialize the given collection --- 1,12 ---- using NHibernate.Collection; using NHibernate.Engine; ! namespace NHibernate.Loader { /// <summary> /// An interface for collection loaders /// </summary> ! public interface ICollectionInitializer { /// <summary> /// Initialize the given collection *************** *** 18,22 **** /// <param name="owner"></param> /// <param name="session"></param> ! void Initialize(object id, PersistentCollection collection, object owner, ISessionImplementor session); } ! } --- 16,20 ---- /// <param name="owner"></param> /// <param name="session"></param> ! void Initialize( object id, PersistentCollection collection, object owner, ISessionImplementor session ); } ! } \ No newline at end of file Index: IUniqueEntityLoader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/IUniqueEntityLoader.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IUniqueEntityLoader.cs 2 Apr 2004 15:55:48 -0000 1.2 --- IUniqueEntityLoader.cs 31 Dec 2004 20:57:44 -0000 1.3 *************** *** 1,8 **** - using System; using NHibernate.Engine; ! namespace NHibernate.Loader { ! public interface IUniqueEntityLoader { /// <summary> --- 1,8 ---- using NHibernate.Engine; ! namespace NHibernate.Loader { ! /// <summary></summary> ! public interface IUniqueEntityLoader { /// <summary> *************** *** 14,18 **** /// <param name="optionalObject"></param> /// <returns></returns> ! object Load(ISessionImplementor session, object id, object optionalObject); } ! } --- 14,18 ---- /// <param name="optionalObject"></param> /// <returns></returns> ! object Load( ISessionImplementor session, object id, object optionalObject ); } ! } \ No newline at end of file Index: EntityLoader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/EntityLoader.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** EntityLoader.cs 22 Nov 2004 03:53:07 -0000 1.7 --- EntityLoader.cs 31 Dec 2004 20:57:44 -0000 1.8 *************** *** 1,60 **** - using System; using System.Collections; using System.Data; - using System.Text; - using NHibernate.Engine; using NHibernate.Persister; using NHibernate.SqlCommand; using NHibernate.Type; - using NHibernate.Util; ! namespace NHibernate.Loader { /// <summary> /// Load an entity using outerjoin fetching to fetch associated entities /// </summary> ! public class EntityLoader : AbstractEntityLoader, IUniqueEntityLoader { ! private IType[] idType; ! public EntityLoader(ILoadable persister, ISessionFactoryImplementor factory) : base(persister, factory) { ! idType = new IType[] { persister.IdentifierType }; ! ! SqlSelectBuilder selectBuilder = new SqlSelectBuilder(factory); selectBuilder.SetWhereClause( Alias, persister.IdentifierColumnNames, persister.IdentifierType ); ! ! RenderStatement(selectBuilder, factory); this.SqlString = selectBuilder.ToSqlString(); ! PostInstantiate(); } ! public object Load(ISessionImplementor session, object id, object obj) { ! IList list = LoadEntity(session, new object[] { id }, idType, obj, id, false); ! if (list.Count==1) { ! return list[0]; ! } ! else if (list.Count==0) { return null; ! } ! else { throw new HibernateException( "More than one row with the given identifier was found: " + ! id + ! ", for class: " + ! Persister.ClassName); } } ! protected override object GetResultColumnOrRow(object[] row, IDataReader rs, ISessionImplementor session) { ! return row[row.Length - 1]; } } ! } --- 1,75 ---- using System.Collections; using System.Data; using NHibernate.Engine; using NHibernate.Persister; using NHibernate.SqlCommand; using NHibernate.Type; ! namespace NHibernate.Loader { /// <summary> /// Load an entity using outerjoin fetching to fetch associated entities /// </summary> ! public class EntityLoader : AbstractEntityLoader, IUniqueEntityLoader { ! private IType[ ] idType; ! /// <summary> ! /// ! /// </summary> ! /// <param name="persister"></param> ! /// <param name="factory"></param> ! public EntityLoader( ILoadable persister, ISessionFactoryImplementor factory ) : base( persister, factory ) { ! idType = new IType[ ] {persister.IdentifierType}; ! ! SqlSelectBuilder selectBuilder = new SqlSelectBuilder( factory ); selectBuilder.SetWhereClause( Alias, persister.IdentifierColumnNames, persister.IdentifierType ); ! ! RenderStatement( selectBuilder, factory ); this.SqlString = selectBuilder.ToSqlString(); ! PostInstantiate(); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="session"></param> ! /// <param name="id"></param> ! /// <param name="obj"></param> ! /// <returns></returns> ! public object Load( ISessionImplementor session, object id, object obj ) { ! IList list = LoadEntity( session, new object[ ] {id}, idType, obj, id, false ); ! if( list.Count == 1 ) { ! return list[ 0 ]; ! } ! else if( list.Count == 0 ) { return null; ! } ! else { throw new HibernateException( "More than one row with the given identifier was found: " + ! id + ! ", for class: " + ! Persister.ClassName ); } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="row"></param> ! /// <param name="rs"></param> ! /// <param name="session"></param> ! /// <returns></returns> ! protected override object GetResultColumnOrRow( object[ ] row, IDataReader rs, ISessionImplementor session ) { ! return row[ row.Length - 1 ]; } } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 20:57:37
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26231 Modified Files: AbstractEntityLoader.cs CollectionLoader.cs CriteriaLoader.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: CollectionLoader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/CollectionLoader.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** CollectionLoader.cs 22 Nov 2004 03:53:07 -0000 1.11 --- CollectionLoader.cs 31 Dec 2004 20:57:25 -0000 1.12 *************** *** 1,6 **** using System; - using System.Text; using System.Collections; - using NHibernate.Collection; using NHibernate.Engine; --- 1,4 ---- *************** *** 10,28 **** using NHibernate.Util; ! namespace NHibernate.Loader { /// <summary> /// Loads a collection of values or a many-to-many association /// </summary> ! public class CollectionLoader : OuterJoinLoader, ICollectionInitializer { private CollectionPersister collectionPersister; private IType idType; ! ! public CollectionLoader(CollectionPersister persister, ISessionFactoryImplementor factory) : base(factory.Dialect) { idType = persister.KeyType; ! string alias = ToAlias( persister.QualifiedTableName, 0); //TODO: H2.0.3 the whereString is appended with the " and " - I don't think --- 8,31 ---- using NHibernate.Util; ! namespace NHibernate.Loader { /// <summary> /// Loads a collection of values or a many-to-many association /// </summary> ! public class CollectionLoader : OuterJoinLoader, ICollectionInitializer { private CollectionPersister collectionPersister; private IType idType; ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="persister"></param> ! /// <param name="factory"></param> ! public CollectionLoader( CollectionPersister persister, ISessionFactoryImplementor factory ) : base( factory.Dialect ) { idType = persister.KeyType; ! string alias = ToAlias( persister.QualifiedTableName, 0 ); //TODO: H2.0.3 the whereString is appended with the " and " - I don't think *************** *** 30,80 **** // probably already takes this into account. SqlString whereSqlString = null; ! if (persister.HasWhere) ! whereSqlString = new SqlString(persister.GetSQLWhereString(alias)); ! ! IList associations = WalkCollectionTree(persister, alias, factory); int joins = associations.Count; Suffixes = new string[joins]; ! for (int i=0; i<joins; i++) Suffixes[i] = i.ToString() + StringHelper.Underscore; ! JoinFragment ojf = OuterJoins(associations); ! ! SqlSelectBuilder selectBuilder = new SqlSelectBuilder(factory); selectBuilder.SetSelectClause( ! persister.SelectClauseFragment(alias) + ! (joins==0 ? String.Empty: ", " + SelectString(associations)) ) ! .SetFromClause(persister.QualifiedTableName, alias) ! .SetWhereClause(alias, persister.KeyColumnNames, persister.KeyType) ! .SetOuterJoins(ojf.ToFromFragmentString, ojf.ToWhereFragmentString); ! ! if(persister.HasWhere) selectBuilder.AddWhereClause(whereSqlString); ! ! if(persister.HasOrdering) selectBuilder.SetOrderByClause(persister.GetSQLOrderByString(alias)); this.SqlString = selectBuilder.ToSqlString(); Persisters = new ILoadable[joins]; ! LockModeArray = CreateLockModeArray(joins, LockMode.None); ! for (int i=0; i<joins; i++) { ! Persisters[i] = (ILoadable) ((OuterJoinableAssociation) associations[i]).Subpersister; } this.collectionPersister = persister; PostInstantiate(); ! } ! protected override CollectionPersister CollectionPersister { get { return collectionPersister; } } ! public void Initialize(object id, PersistentCollection collection, object owner, ISessionImplementor session) { ! LoadCollection(session, id, idType, owner, collection); } } ! } --- 33,102 ---- // probably already takes this into account. SqlString whereSqlString = null; ! if( persister.HasWhere ) ! { ! whereSqlString = new SqlString( persister.GetSQLWhereString( alias ) ); ! } ! ! IList associations = WalkCollectionTree( persister, alias, factory ); int joins = associations.Count; Suffixes = new string[joins]; ! for( int i = 0; i < joins; i++ ) ! { ! Suffixes[ i ] = i.ToString() + StringHelper.Underscore; ! } ! JoinFragment ojf = OuterJoins( associations ); ! ! SqlSelectBuilder selectBuilder = new SqlSelectBuilder( factory ); selectBuilder.SetSelectClause( ! persister.SelectClauseFragment( alias ) + ! ( joins == 0 ? String.Empty : ", " + SelectString( associations ) ) ) ! .SetFromClause( persister.QualifiedTableName, alias ) ! .SetWhereClause( alias, persister.KeyColumnNames, persister.KeyType ) ! .SetOuterJoins( ojf.ToFromFragmentString, ojf.ToWhereFragmentString ); ! ! if( persister.HasWhere ) ! { ! selectBuilder.AddWhereClause( whereSqlString ); ! } ! ! if( persister.HasOrdering ) ! { ! selectBuilder.SetOrderByClause( persister.GetSQLOrderByString( alias ) ); ! } this.SqlString = selectBuilder.ToSqlString(); Persisters = new ILoadable[joins]; ! LockModeArray = CreateLockModeArray( joins, LockMode.None ); ! for( int i = 0; i < joins; i++ ) { ! Persisters[ i ] = ( ILoadable ) ( ( OuterJoinableAssociation ) associations[ i ] ).Subpersister; } this.collectionPersister = persister; PostInstantiate(); ! } ! /// <summary></summary> ! protected override CollectionPersister CollectionPersister { get { return collectionPersister; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="id"></param> ! /// <param name="collection"></param> ! /// <param name="owner"></param> ! /// <param name="session"></param> ! public void Initialize( object id, PersistentCollection collection, object owner, ISessionImplementor session ) { ! LoadCollection( session, id, idType, owner, collection ); } } ! } \ No newline at end of file Index: AbstractEntityLoader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/AbstractEntityLoader.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** AbstractEntityLoader.cs 22 Nov 2004 03:53:07 -0000 1.12 --- AbstractEntityLoader.cs 31 Dec 2004 20:57:25 -0000 1.13 *************** *** 1,6 **** using System; - using System.Text; using System.Collections; - using NHibernate.Engine; using NHibernate.Persister; --- 1,4 ---- *************** *** 8,26 **** using NHibernate.Util; ! namespace NHibernate.Loader { ! ! public class AbstractEntityLoader : OuterJoinLoader { private ILoadable persister; private string alias; ! public AbstractEntityLoader(ILoadable persister, ISessionFactoryImplementor factory) : base(factory.Dialect) { this.persister = persister; ! alias = ToAlias(persister.ClassName, 0); } ! protected string Alias { get { return alias; } --- 6,30 ---- using NHibernate.Util; ! namespace NHibernate.Loader { ! /// <summary></summary> ! public class AbstractEntityLoader : OuterJoinLoader { private ILoadable persister; private string alias; ! /// <summary> ! /// ! /// </summary> ! /// <param name="persister"></param> ! /// <param name="factory"></param> ! public AbstractEntityLoader( ILoadable persister, ISessionFactoryImplementor factory ) : base( factory.Dialect ) { this.persister = persister; ! alias = ToAlias( persister.ClassName, 0 ); } ! /// <summary></summary> ! protected string Alias { get { return alias; } *************** *** 30,133 **** /// Gets the <see cref="ILoadable"/> Persister. /// </summary> ! protected ILoadable Persister { get { return persister; } } ! protected void RenderStatement(SqlSelectBuilder selectBuilder, ISessionFactoryImplementor factory) { ! RenderStatement(selectBuilder, String.Empty, factory); } ! protected void RenderStatement(SqlSelectBuilder selectBuilder, string orderBy, ISessionFactoryImplementor factory) { ! IList associations = WalkTree(persister, alias, factory); ! int joins=associations.Count; ! Suffixes = new string[joins+1]; ! for (int i=0; i<=joins; i++) Suffixes[i] = (joins==0) ? String.Empty : i.ToString() + StringHelper.Underscore; ! JoinFragment ojf = OuterJoins(associations); selectBuilder.SetSelectClause( ! (joins==0 ? String.Empty : SelectString(associations) + ",") + ! SelectString(persister, alias, Suffixes[joins] ) ) .SetFromClause ( ! persister.FromTableFragment(alias).Append( ! persister.FromJoinFragment(alias, true, true) ) ) .SetOuterJoins ! ( ! ojf.ToFromFragmentString, ! ojf.ToWhereFragmentString.Append( ! UseQueryWhereFragment ? ! ( (IQueryable) persister).QueryWhereFragment(alias, true, true) : ! persister.WhereJoinFragment(alias, true, true) ) ! ) ! .SetOrderByClause(orderBy); ! Persisters = new ILoadable[joins+1]; ! // classPersisters = new ILoadable[joins+1]; ! LockModeArray = CreateLockModeArray(joins+1, LockMode.None); ! for (int i=0; i<joins; i++) { ! Persisters[i] = ((OuterJoinableAssociation)associations[i]).Subpersister; } ! Persisters[joins] = persister; } ! protected void RenderStatement(SqlString condition, ISessionFactoryImplementor factory) { ! RenderStatement(condition, String.Empty, factory); } ! protected void RenderStatement(SqlString condition, string orderBy, ISessionFactoryImplementor factory) { ! SqlSelectBuilder sqlBuilder = new SqlSelectBuilder(factory); ! IList associations = WalkTree(persister, alias, factory); ! int joins=associations.Count; ! Suffixes = new string[joins+1]; ! for (int i=0; i<=joins; i++) Suffixes[i] = (joins==0) ? String.Empty : i.ToString() + StringHelper.Underscore; ! JoinFragment ojf = OuterJoins(associations); sqlBuilder.SetSelectClause( ! (joins==0 ? String.Empty : SelectString(associations) + ",") + ! SelectString(persister, alias, Suffixes[joins] ) ); sqlBuilder.SetFromClause( ! persister.FromTableFragment(alias).Append( ! persister.FromJoinFragment(alias, true, true) ! ) ! ); ! sqlBuilder.AddWhereClause(condition); sqlBuilder.SetOuterJoins( ojf.ToFromFragmentString, ! ojf.ToWhereFragmentString.Append ! ( ! UseQueryWhereFragment ? ! ( (IQueryable) persister).QueryWhereFragment(alias, true, true) : ! persister.WhereJoinFragment(alias, true, true) ) ); ! sqlBuilder.SetOrderByClause(orderBy); this.SqlString = sqlBuilder.ToSqlString(); ! Persisters = new ILoadable[joins+1]; ! LockModeArray = CreateLockModeArray(joins+1, LockMode.None); ! for (int i=0; i<joins; i++) { ! Persisters[i] = ((OuterJoinableAssociation)associations[i]).Subpersister; } ! Persisters[joins] = persister; } --- 34,165 ---- /// Gets the <see cref="ILoadable"/> Persister. /// </summary> ! protected ILoadable Persister { get { return persister; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="selectBuilder"></param> ! /// <param name="factory"></param> ! protected void RenderStatement( SqlSelectBuilder selectBuilder, ISessionFactoryImplementor factory ) { ! RenderStatement( selectBuilder, String.Empty, factory ); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="selectBuilder"></param> ! /// <param name="orderBy"></param> ! /// <param name="factory"></param> ! protected void RenderStatement( SqlSelectBuilder selectBuilder, string orderBy, ISessionFactoryImplementor factory ) { ! IList associations = WalkTree( persister, alias, factory ); ! int joins = associations.Count; ! Suffixes = new string[joins + 1]; ! for( int i = 0; i <= joins; i++ ) ! { ! Suffixes[ i ] = ( joins == 0 ) ? String.Empty : i.ToString() + StringHelper.Underscore; ! } ! JoinFragment ojf = OuterJoins( associations ); selectBuilder.SetSelectClause( ! ( joins == 0 ? String.Empty : SelectString( associations ) + "," ) + ! SelectString( persister, alias, Suffixes[ joins ] ) ) .SetFromClause ( ! persister.FromTableFragment( alias ).Append( ! persister.FromJoinFragment( alias, true, true ) ) ) .SetOuterJoins ! ( ! ojf.ToFromFragmentString, ! ojf.ToWhereFragmentString.Append( ! UseQueryWhereFragment ? ! ( ( IQueryable ) persister ).QueryWhereFragment( alias, true, true ) : ! persister.WhereJoinFragment( alias, true, true ) ) ! ) ! .SetOrderByClause( orderBy ); ! Persisters = new ILoadable[joins + 1]; ! // classPersisters = new ILoadable[joins+1]; ! LockModeArray = CreateLockModeArray( joins + 1, LockMode.None ); ! for( int i = 0; i < joins; i++ ) { ! Persisters[ i ] = ( ( OuterJoinableAssociation ) associations[ i ] ).Subpersister; } ! Persisters[ joins ] = persister; } ! /// <summary> ! /// ! /// </summary> ! /// <param name="condition"></param> ! /// <param name="factory"></param> ! protected void RenderStatement( SqlString condition, ISessionFactoryImplementor factory ) { ! RenderStatement( condition, String.Empty, factory ); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="condition"></param> ! /// <param name="orderBy"></param> ! /// <param name="factory"></param> ! protected void RenderStatement( SqlString condition, string orderBy, ISessionFactoryImplementor factory ) { ! SqlSelectBuilder sqlBuilder = new SqlSelectBuilder( factory ); ! IList associations = WalkTree( persister, alias, factory ); ! int joins = associations.Count; ! Suffixes = new string[joins + 1]; ! for( int i = 0; i <= joins; i++ ) ! { ! Suffixes[ i ] = ( joins == 0 ) ? String.Empty : i.ToString() + StringHelper.Underscore; ! } ! JoinFragment ojf = OuterJoins( associations ); sqlBuilder.SetSelectClause( ! ( joins == 0 ? String.Empty : SelectString( associations ) + "," ) + ! SelectString( persister, alias, Suffixes[ joins ] ) ); sqlBuilder.SetFromClause( ! persister.FromTableFragment( alias ).Append( ! persister.FromJoinFragment( alias, true, true ) ! ) ! ); ! sqlBuilder.AddWhereClause( condition ); sqlBuilder.SetOuterJoins( ojf.ToFromFragmentString, ! ojf.ToWhereFragmentString.Append ! ( ! UseQueryWhereFragment ? ! ( ( IQueryable ) persister ).QueryWhereFragment( alias, true, true ) : ! persister.WhereJoinFragment( alias, true, true ) ) ); ! sqlBuilder.SetOrderByClause( orderBy ); this.SqlString = sqlBuilder.ToSqlString(); ! Persisters = new ILoadable[joins + 1]; ! LockModeArray = CreateLockModeArray( joins + 1, LockMode.None ); ! for( int i = 0; i < joins; i++ ) { ! Persisters[ i ] = ( ( OuterJoinableAssociation ) associations[ i ] ).Subpersister; } ! Persisters[ joins ] = persister; } *************** *** 139,145 **** protected virtual bool UseQueryWhereFragment { ! get { return false;} } } ! } --- 171,177 ---- protected virtual bool UseQueryWhereFragment { ! get { return false; } } } ! } \ No newline at end of file Index: CriteriaLoader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/CriteriaLoader.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** CriteriaLoader.cs 21 Nov 2004 22:56:29 -0000 1.10 --- CriteriaLoader.cs 31 Dec 2004 20:57:25 -0000 1.11 *************** *** 1,16 **** - using System; using System.Collections; using System.Data; using System.Text; - - using NHibernate; using NHibernate.Engine; using NHibernate.Expression; - using NHibernate.Impl; using NHibernate.Persister; using NHibernate.Type; using NHibernate.Util; ! namespace NHibernate.Loader { /// <summary> --- 1,12 ---- using System.Collections; using System.Data; using System.Text; using NHibernate.Engine; using NHibernate.Expression; using NHibernate.Persister; using NHibernate.Type; using NHibernate.Util; ! namespace NHibernate.Loader { /// <summary> *************** *** 21,57 **** /// queries are more like multi-object <c>Load()</c>s than like HQL queries. /// </remarks> ! public class CriteriaLoader : AbstractEntityLoader { private ICriteria criteria; //private static readonly IType[] noTypes = new IType[0]; ! public CriteriaLoader(ILoadable persister, ISessionFactoryImplementor factory, ICriteria criteria) : base(persister, factory) { this.criteria = criteria; ! IEnumerator iter = criteria.IterateExpressions(); ! ! StringBuilder orderByBuilder = new StringBuilder(60); bool commaNeeded = false; ! iter = criteria.IterateOrderings(); ! ! while ( iter.MoveNext() ) ! { ! Order ord = (Order) iter.Current; ! ! if(commaNeeded) orderByBuilder.Append(StringHelper.CommaSpace); commaNeeded = true; - - orderByBuilder.Append(ord.ToStringForSql(factory, criteria.PersistentClass, Alias)); - } ! RenderStatement(criteria.Expression.ToSqlString(factory, criteria.PersistentClass, Alias), orderByBuilder.ToString(), factory); ! PostInstantiate(); ! } ! ! public IList List(ISessionImplementor session) { ArrayList values = new ArrayList(); --- 17,67 ---- /// queries are more like multi-object <c>Load()</c>s than like HQL queries. /// </remarks> ! public class CriteriaLoader : AbstractEntityLoader { private ICriteria criteria; //private static readonly IType[] noTypes = new IType[0]; ! /// <summary> ! /// ! /// </summary> ! /// <param name="persister"></param> ! /// <param name="factory"></param> ! /// <param name="criteria"></param> ! public CriteriaLoader( ILoadable persister, ISessionFactoryImplementor factory, ICriteria criteria ) : base( persister, factory ) { this.criteria = criteria; ! IEnumerator iter = criteria.IterateExpressions(); ! ! StringBuilder orderByBuilder = new StringBuilder( 60 ); bool commaNeeded = false; ! iter = criteria.IterateOrderings(); ! ! while( iter.MoveNext() ) ! { ! Order ord = ( Order ) iter.Current; ! ! if( commaNeeded ) ! { ! orderByBuilder.Append( StringHelper.CommaSpace ); ! } commaNeeded = true; ! orderByBuilder.Append( ord.ToStringForSql( factory, criteria.PersistentClass, Alias ) ); ! } ! ! RenderStatement( criteria.Expression.ToSqlString( factory, criteria.PersistentClass, Alias ), orderByBuilder.ToString(), factory ); ! PostInstantiate(); ! } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="session"></param> ! /// <returns></returns> ! public IList List( ISessionImplementor session ) { ArrayList values = new ArrayList(); *************** *** 59,82 **** IEnumerator iter = criteria.IterateExpressions(); ! while ( iter.MoveNext() ) ! { ! Expression.Expression expr = (Expression.Expression) iter.Current; ! TypedValue[] tv = expr.GetTypedValues( session.Factory, criteria.PersistentClass ); ! for ( int i=0; i<tv.Length; i++ ) { ! values.Add( tv[i].Value ); ! types.Add( tv[i].Type ); } } ! object[] valueArray = values.ToArray(); ! IType[] typeArray = (IType[]) types.ToArray(typeof(IType)); ! QueryParameters qp = new QueryParameters( typeArray, valueArray, null, criteria.Selection ); return Find( session, qp, true ); } ! protected override object GetResultColumnOrRow(object[] row, IDataReader rs, ISessionImplementor session) { ! return row[ row.Length-1 ]; } --- 69,99 ---- IEnumerator iter = criteria.IterateExpressions(); ! while( iter.MoveNext() ) ! { ! Expression.Expression expr = ( Expression.Expression ) iter.Current; ! TypedValue[ ] tv = expr.GetTypedValues( session.Factory, criteria.PersistentClass ); ! for( int i = 0; i < tv.Length; i++ ) { ! values.Add( tv[ i ].Value ); ! types.Add( tv[ i ].Type ); } } ! object[ ] valueArray = values.ToArray(); ! IType[ ] typeArray = ( IType[ ] ) types.ToArray( typeof( IType ) ); ! QueryParameters qp = new QueryParameters( typeArray, valueArray, null, criteria.Selection ); return Find( session, qp, true ); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="row"></param> ! /// <param name="rs"></param> ! /// <param name="session"></param> ! /// <returns></returns> ! protected override object GetResultColumnOrRow( object[ ] row, IDataReader rs, ISessionImplementor session ) { ! return row[ row.Length - 1 ]; } *************** *** 87,104 **** /// <param name="pathExpression"></param> /// <returns></returns> ! public string[] ToColumns(string pathExpression) { return null; } ! protected override bool EnableJoinedFetch(bool mappingDefault, string path, string table, string[] foreignKeyColumns) { ! FetchMode fm = criteria.GetFetchMode(path); //fm==null || - an Enum can't be null ! if (fm==FetchMode.Default) { return mappingDefault; } ! else { return fm == FetchMode.Eager; --- 104,129 ---- /// <param name="pathExpression"></param> /// <returns></returns> ! public string[ ] ToColumns( string pathExpression ) { return null; } ! /// <summary> ! /// ! /// </summary> ! /// <param name="mappingDefault"></param> ! /// <param name="path"></param> ! /// <param name="table"></param> ! /// <param name="foreignKeyColumns"></param> ! /// <returns></returns> ! protected override bool EnableJoinedFetch( bool mappingDefault, string path, string table, string[ ] foreignKeyColumns ) { ! FetchMode fm = criteria.GetFetchMode( path ); //fm==null || - an Enum can't be null ! if( fm == FetchMode.Default ) { return mappingDefault; } ! else { return fm == FetchMode.Eager; *************** *** 106,112 **** } protected override bool UseQueryWhereFragment { ! get {return true;} } --- 131,138 ---- } + /// <summary></summary> protected override bool UseQueryWhereFragment { ! get { return true; } } |
From: Kevin W. <kev...@us...> - 2004-12-31 19:55:03
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13297 Modified Files: Status.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: Status.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/Status.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Status.cs 9 Dec 2004 22:08:54 -0000 1.1 --- Status.cs 31 Dec 2004 19:54:53 -0000 1.2 *************** *** 10,14 **** /// </summary> [Serializable] ! internal enum Status { /// <summary> --- 10,14 ---- /// </summary> [Serializable] ! internal enum Status { /// <summary> *************** *** 38,40 **** Saving } ! } --- 38,40 ---- Saving } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 19:54:51
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13257 Modified Files: SessionImpl.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: SessionImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionImpl.cs,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** SessionImpl.cs 16 Dec 2004 21:55:24 -0000 1.57 --- SessionImpl.cs 31 Dec 2004 19:54:42 -0000 1.58 *************** *** 3,11 **** using System.Data; using System.Runtime.Serialization; - using System.Text; - using System.Text.RegularExpressions; - using Iesi.Collections; ! using NHibernate.Cache; using NHibernate.Collection; --- 3,8 ---- [...7412 lines suppressed...] ! EvictCollections( ! actype.GetPropertyValues( values[ i ], this ), ! actype.Subtypes ! ); ! } ! } ! } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="entity"></param> ! /// <returns></returns> ! public object GetVersion( object entity ) { ! return GetEntry( entity ).Version; } } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 19:54:40
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13198 Modified Files: SessionFactoryObjectFactory.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: SessionFactoryObjectFactory.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionFactoryObjectFactory.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SessionFactoryObjectFactory.cs 21 Sep 2004 09:58:24 -0000 1.2 --- SessionFactoryObjectFactory.cs 31 Dec 2004 19:54:30 -0000 1.3 *************** *** 1,4 **** - using System; using System.Collections; namespace NHibernate.Impl --- 1,4 ---- using System.Collections; + using log4net; namespace NHibernate.Impl *************** *** 25,36 **** // to stop this class from being unloaded - this is a comment // from h2.0.3 - is this applicable to .net also??? ! private static readonly SessionFactoryObjectFactory Instance; ! private static readonly log4net.ILog log; ! static SessionFactoryObjectFactory() { ! log = log4net.LogManager.GetLogger( typeof(SessionFactoryObjectFactory) ); Instance = new SessionFactoryObjectFactory(); ! log.Debug("initializing class SessionFactoryObjectFactory"); } --- 25,37 ---- // to stop this class from being unloaded - this is a comment // from h2.0.3 - is this applicable to .net also??? ! private static readonly SessionFactoryObjectFactory Instance; // not used !?! ! private static readonly ILog log; ! /// <summary></summary> ! static SessionFactoryObjectFactory() { ! log = LogManager.GetLogger( typeof( SessionFactoryObjectFactory ) ); Instance = new SessionFactoryObjectFactory(); ! log.Debug( "initializing class SessionFactoryObjectFactory" ); } *************** *** 47,72 **** /// <param name="instance">The ISessionFactory.</param> /// <param name="properties">The configured properties for the ISessionFactory.</param> ! public static void AddInstance(string uid, string name, ISessionFactory instance, IDictionary properties) { ! if(log.IsDebugEnabled) { ! string nameMsg = "unnamed"; ! if(name!=null && name.Length > 0) ! { ! nameMsg = name; ! } ! log.Debug( "registered: " + uid + "(" + name + ")" ); } ! Instances[uid] = instance; ! if(name!=null && name.Length > 0) { ! log.Info("Factory name:" + name); ! NamedInstances[name] = instance; } ! else { ! log.Info("no name configured"); } --- 48,69 ---- /// <param name="instance">The ISessionFactory.</param> /// <param name="properties">The configured properties for the ISessionFactory.</param> ! public static void AddInstance( string uid, string name, ISessionFactory instance, IDictionary properties ) { ! if( log.IsDebugEnabled ) { ! string nameMsg = ( ( name != null && name.Length > 0 ) ? name : "unnamed" ); ! log.Debug( "registered: " + uid + "(" + nameMsg + ")" ); } ! Instances[ uid ] = instance; ! if( name != null && name.Length > 0 ) { ! log.Info( "Factory name:" + name ); ! NamedInstances[ name ] = instance; } ! else { ! log.Info( "no name configured" ); } *************** *** 79,92 **** /// <param name="name">The name of the ISessionFactory.</param> /// <param name="properties">The configured properties for the ISessionFactory.</param> ! public static void RemoveInstance(string uid, string name, IDictionary properties) { ! if(name!=null && name.Length > 0) { ! log.Info("unbinding factory: " + name); ! NamedInstances.Remove(name); } ! Instances.Remove(uid); } --- 76,89 ---- /// <param name="name">The name of the ISessionFactory.</param> /// <param name="properties">The configured properties for the ISessionFactory.</param> ! public static void RemoveInstance( string uid, string name, IDictionary properties ) { ! if( name != null && name.Length > 0 ) { ! log.Info( "unbinding factory: " + name ); ! NamedInstances.Remove( name ); } ! Instances.Remove( uid ); } *************** *** 96,104 **** /// <param name="name">The name of the ISessionFactory.</param> /// <returns>An instantiated ISessionFactory.</returns> ! public static ISessionFactory GetNamedInstance(string name) { ! log.Debug( "lookup: name=" + name); ! ISessionFactory factory = NamedInstances[name] as ISessionFactory; ! if(factory==null) { log.Warn( "Not found: " + name ); --- 93,101 ---- /// <param name="name">The name of the ISessionFactory.</param> /// <returns>An instantiated ISessionFactory.</returns> ! public static ISessionFactory GetNamedInstance( string name ) { ! log.Debug( "lookup: name=" + name ); ! ISessionFactory factory = NamedInstances[ name ] as ISessionFactory; ! if( factory == null ) { log.Warn( "Not found: " + name ); *************** *** 112,120 **** /// <param name="uid">The identifier of the ISessionFactory.</param> /// <returns>An instantiated ISessionFactory.</returns> ! public static ISessionFactory GetInstance(string uid) { log.Debug( "lookup: uid=" + uid ); ! ISessionFactory factory = Instances[uid] as ISessionFactory; ! if(factory==null) { log.Warn( "Not found: " + uid ); --- 109,117 ---- /// <param name="uid">The identifier of the ISessionFactory.</param> /// <returns>An instantiated ISessionFactory.</returns> ! public static ISessionFactory GetInstance( string uid ) { log.Debug( "lookup: uid=" + uid ); ! ISessionFactory factory = Instances[ uid ] as ISessionFactory; ! if( factory == null ) { log.Warn( "Not found: " + uid ); *************** *** 123,125 **** } } ! } --- 120,122 ---- } } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 19:54:28
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13167 Modified Files: SessionFactoryImpl.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: SessionFactoryImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionFactoryImpl.cs,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** SessionFactoryImpl.cs 21 Dec 2004 20:43:40 -0000 1.37 --- SessionFactoryImpl.cs 31 Dec 2004 19:54:19 -0000 1.38 *************** *** 2,16 **** using System.Collections; using System.Data; - using System.IO; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Text; ! using System.Xml; ! using NHibernate.Cache; - using NHibernate.Connection; [...1415 lines suppressed...] ! p.CacheConcurrencyStrategy.Remove( id ); ! } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="roleName"></param> ! public void EvictCollection( string roleName ) { ! CollectionPersister p = GetCollectionPersister( roleName ); ! if( p.HasCache ) ! { ! p.CacheConcurrencyStrategy.Clear(); ! } } ! } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 19:54:17
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13137 Modified Files: ScheduledUpdate.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: ScheduledUpdate.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/ScheduledUpdate.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ScheduledUpdate.cs 28 Nov 2004 21:47:46 -0000 1.7 --- ScheduledUpdate.cs 31 Dec 2004 19:54:07 -0000 1.8 *************** *** 1,19 **** - using System; - using NHibernate.Cache; using NHibernate.Engine; using NHibernate.Persister; ! namespace NHibernate.Impl { /// <summary> /// A scheduled update of an object. /// </summary> ! internal class ScheduledUpdate : ScheduledEntityAction { ! private object[] _fields; private object _lastVersion; private object _nextVersion; ! private int[] _dirtyFields; ! private object[] _updatedState; /// <summary> --- 1,17 ---- using NHibernate.Engine; using NHibernate.Persister; ! namespace NHibernate.Impl { /// <summary> /// A scheduled update of an object. /// </summary> ! internal class ScheduledUpdate : ScheduledEntityAction { ! private object[ ] _fields; private object _lastVersion; private object _nextVersion; ! private int[ ] _dirtyFields; ! private object[ ] _updatedState; /// <summary> *************** *** 29,34 **** /// <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 ScheduledUpdate(object id, object[] fields, int[] dirtyProperties, object lastVersion, object nextVersion, object instance, object[] updatedState, IClassPersister persister, ISessionImplementor session) ! : base(session, id, instance, persister) { _fields = fields; --- 27,32 ---- /// <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 ScheduledUpdate( object id, object[ ] fields, int[ ] dirtyProperties, object lastVersion, object nextVersion, object instance, object[ ] updatedState, IClassPersister persister, ISessionImplementor session ) ! : base( session, id, instance, persister ) { _fields = fields; *************** *** 39,47 **** } ! public override void Execute() { ! if ( Persister.HasCache ) { ! Persister.Cache.Lock(Id); } Persister.Update( Id, _fields, _dirtyFields, _lastVersion, Instance, Session ); --- 37,46 ---- } ! /// <summary></summary> ! public override void Execute() { ! if( Persister.HasCache ) { ! Persister.Cache.Lock( Id ); } Persister.Update( Id, _fields, _dirtyFields, _lastVersion, Instance, Session ); *************** *** 49,59 **** } ! public override void AfterTransactionCompletion() { ! if( Persister.HasCache ) { ! Persister.Cache.Release( Id) ; } } } ! } --- 48,59 ---- } ! /// <summary></summary> ! public override void AfterTransactionCompletion() { ! if( Persister.HasCache ) { ! Persister.Cache.Release( Id ); } } } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 19:54:04
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13068 Modified Files: ScheduledInsertion.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: ScheduledInsertion.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/ScheduledInsertion.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ScheduledInsertion.cs 29 Nov 2004 04:45:51 -0000 1.4 --- ScheduledInsertion.cs 31 Dec 2004 19:53:54 -0000 1.5 *************** *** 1,16 **** - using System; - using NHibernate.Cache; using NHibernate.Engine; using NHibernate.Persister; ! namespace NHibernate.Impl { /// <summary> /// A scheduled insertion of an object. /// </summary> ! internal class ScheduledInsertion : ScheduledEntityAction { ! ! private readonly object[] _state; /// <summary> --- 1,13 ---- using NHibernate.Engine; using NHibernate.Persister; ! namespace NHibernate.Impl { /// <summary> /// A scheduled insertion of an object. /// </summary> ! internal class ScheduledInsertion : ScheduledEntityAction { ! private readonly object[ ] _state; /// <summary> *************** *** 22,41 **** /// <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; } ! public override void Execute() { ! Persister.Insert( Id, _state, Instance, Session); Session.PostInsert( Instance ); } ! public override void AfterTransactionCompletion() { // do nothing } } ! } --- 19,40 ---- /// <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; } ! /// <summary></summary> ! public override void Execute() { ! Persister.Insert( Id, _state, Instance, Session ); Session.PostInsert( Instance ); } ! /// <summary></summary> ! public override void AfterTransactionCompletion() { // do nothing } } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 19:53:53
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13030 Modified Files: ScheduledEntityAction.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: ScheduledEntityAction.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/ScheduledEntityAction.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ScheduledEntityAction.cs 9 Dec 2004 22:08:54 -0000 1.7 --- ScheduledEntityAction.cs 31 Dec 2004 19:53:44 -0000 1.8 *************** *** 1,8 **** - using System; using NHibernate.Engine; using NHibernate.Persister; - using NHibernate.Cache; ! namespace NHibernate.Impl { /// <summary> --- 1,6 ---- using NHibernate.Engine; using NHibernate.Persister; ! namespace NHibernate.Impl { /// <summary> *************** *** 10,16 **** /// flush. /// </summary> ! internal abstract class ScheduledEntityAction : IExecutable { - private readonly ISessionImplementor _session; private readonly object _id; --- 8,13 ---- /// flush. /// </summary> ! internal abstract class ScheduledEntityAction : IExecutable { private readonly ISessionImplementor _session; private readonly object _id; *************** *** 25,29 **** /// <param name="instance">The actual object instance.</param> /// <param name="persister">The <see cref="IClassPersister"/> that is responsible for the persisting the object.</param> ! protected ScheduledEntityAction(ISessionImplementor session, object id, object instance, IClassPersister persister) { _session = session; --- 22,26 ---- /// <param name="instance">The actual object instance.</param> /// <param name="persister">The <see cref="IClassPersister"/> that is responsible for the persisting the object.</param> ! protected ScheduledEntityAction( ISessionImplementor session, object id, object instance, IClassPersister persister ) { _session = session; *************** *** 37,43 **** /// Gets the <see cref="ISessionImplementor"/> the action is executing in. /// </summary> ! protected ISessionImplementor Session { ! get { return _session;} } --- 34,40 ---- /// Gets the <see cref="ISessionImplementor"/> the action is executing in. /// </summary> ! protected ISessionImplementor Session { ! get { return _session; } } *************** *** 45,49 **** /// Gets the identifier of the object. /// </summary> ! protected object Id { get { return _id; } --- 42,46 ---- /// Gets the identifier of the object. /// </summary> ! protected object Id { get { return _id; } *************** *** 53,59 **** /// Gets the <see cref="IClassPersister"/> that is responsible for persisting the object. /// </summary> ! protected IClassPersister Persister { ! get { return _persister;} } --- 50,56 ---- /// Gets the <see cref="IClassPersister"/> that is responsible for persisting the object. /// </summary> ! protected IClassPersister Persister { ! get { return _persister; } } *************** *** 61,72 **** /// Gets the object that is having the scheduled action performed against it. /// </summary> ! protected object Instance { get { return _instance; } } ! #region SessionImpl.IExecutable Members - /// <summary> /// Called when the Transaction this action occurred in has completed. --- 58,68 ---- /// Gets the object that is having the scheduled action performed against it. /// </summary> ! protected object Instance { get { return _instance; } } ! #region SessionImpl.IExecutable Members /// <summary> /// Called when the Transaction this action occurred in has completed. *************** *** 79,83 **** public abstract void Execute(); ! public object[] PropertySpaces { get { return _persister.PropertySpaces; } --- 75,80 ---- public abstract void Execute(); ! /// <summary></summary> ! public object[ ] PropertySpaces { get { return _persister.PropertySpaces; } *************** *** 85,89 **** #endregion - } ! } --- 82,85 ---- #endregion } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 19:53:44
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12997 Modified Files: ScheduledDeletion.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: ScheduledDeletion.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/ScheduledDeletion.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ScheduledDeletion.cs 28 Nov 2004 21:47:46 -0000 1.4 --- ScheduledDeletion.cs 31 Dec 2004 19:53:33 -0000 1.5 *************** *** 1,14 **** - using System; - using NHibernate.Cache; using NHibernate.Engine; using NHibernate.Persister; ! namespace NHibernate.Impl { /// <summary> /// A scheduled deletion of an object. /// </summary> ! internal class ScheduledDeletion : ScheduledEntityAction ! { private object _version; --- 1,12 ---- using NHibernate.Engine; using NHibernate.Persister; ! namespace NHibernate.Impl { /// <summary> /// A scheduled deletion of an object. /// </summary> ! internal class ScheduledDeletion : ScheduledEntityAction ! { private object _version; *************** *** 21,33 **** /// <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 ScheduledDeletion(object id, object version, object instance, IClassPersister persister, ISessionImplementor session) ! : base(session, id, instance, persister) { _version = version; } ! public override void Execute() { ! if( Persister.HasCache ) { Persister.Cache.Lock( Id ); --- 19,32 ---- /// <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 ScheduledDeletion( object id, object version, object instance, IClassPersister persister, ISessionImplementor session ) ! : base( session, id, instance, persister ) { _version = version; } ! /// <summary></summary> ! public override void Execute() { ! if( Persister.HasCache ) { Persister.Cache.Lock( Id ); *************** *** 37,43 **** } ! public override void AfterTransactionCompletion() { ! if ( Persister.HasCache ) { Persister.Cache.Release( Id ); --- 36,43 ---- } ! /// <summary></summary> ! public override void AfterTransactionCompletion() { ! if( Persister.HasCache ) { Persister.Cache.Release( Id ); *************** *** 45,47 **** } } ! } --- 45,47 ---- } } ! } \ No newline at end of file |
From: Kevin W. <kev...@us...> - 2004-12-31 19:53:33
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12969 Modified Files: ScheduledCollectionUpdate.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: ScheduledCollectionUpdate.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/ScheduledCollectionUpdate.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ScheduledCollectionUpdate.cs 29 Nov 2004 15:31:07 -0000 1.6 --- ScheduledCollectionUpdate.cs 31 Dec 2004 19:53:23 -0000 1.7 *************** *** 1,7 **** - using System; using NHibernate.Collection; using NHibernate.Engine; ! namespace NHibernate.Impl { /// <summary> --- 1,6 ---- using NHibernate.Collection; using NHibernate.Engine; ! namespace NHibernate.Impl { /// <summary> *************** *** 12,20 **** /// and the database should be updated accordingly. /// </remarks> ! internal sealed class ScheduledCollectionUpdate : ScheduledCollectionAction { private readonly PersistentCollection _collection; private readonly bool _emptySnapshot; ! /// <summary> /// Initializes a new instance of <see cref="ScheduledCollectionUpdate"/>. --- 11,19 ---- /// and the database should be updated accordingly. /// </remarks> ! internal sealed class ScheduledCollectionUpdate : ScheduledCollectionAction { private readonly PersistentCollection _collection; private readonly bool _emptySnapshot; ! /// <summary> /// Initializes a new instance of <see cref="ScheduledCollectionUpdate"/>. *************** *** 25,30 **** /// <param name="emptySnapshot">Indicates if the Collection was empty when it was loaded.</param> /// <param name="session">The <see cref="ISessionImplementor"/> that the Action is occuring in.</param> ! public ScheduledCollectionUpdate(PersistentCollection collection, CollectionPersister persister, object id, bool emptySnapshot, ISessionImplementor session) ! : base(persister, id, session) { _collection = collection; --- 24,29 ---- /// <param name="emptySnapshot">Indicates if the Collection was empty when it was loaded.</param> /// <param name="session">The <see cref="ISessionImplementor"/> that the Action is occuring in.</param> ! public ScheduledCollectionUpdate( PersistentCollection collection, CollectionPersister persister, object id, bool emptySnapshot, ISessionImplementor session ) ! : base( persister, id, session ) { _collection = collection; *************** *** 32,64 **** } ! public override void Execute() { Persister.Softlock( Id ); ! if( !_collection.WasInitialized ) { ! if ( !_collection.HasQueuedAdds ) { ! throw new AssertionFailure("bug processing queued adds"); } ! // do nothing - collection was not initialized // we only need to notify the cache... } ! else if( _collection.Empty ) { // the collection had all elements removed - check to see if it // was empty when it was loaded or if the contents were actually // deleted ! if( !_emptySnapshot ) { Persister.Remove( Id, Session ); } } ! else if( _collection.NeedsRecreate( Persister ) ) { // certain collections (Bag) have to be recreated in the db each // time - if the snapshot was not empty then there are some existing // rows that need to be removed. ! if( !_emptySnapshot ) { Persister.Remove( Id, Session ); --- 31,64 ---- } ! /// <summary></summary> ! public override void Execute() { Persister.Softlock( Id ); ! if( !_collection.WasInitialized ) { ! if( !_collection.HasQueuedAdds ) { ! throw new AssertionFailure( "bug processing queued adds" ); } ! // do nothing - collection was not initialized // we only need to notify the cache... } ! else if( _collection.Empty ) { // the collection had all elements removed - check to see if it // was empty when it was loaded or if the contents were actually // deleted ! if( !_emptySnapshot ) { Persister.Remove( Id, Session ); } } ! else if( _collection.NeedsRecreate( Persister ) ) { // certain collections (Bag) have to be recreated in the db each // time - if the snapshot was not empty then there are some existing // rows that need to be removed. ! if( !_emptySnapshot ) { Persister.Remove( Id, Session ); *************** *** 67,71 **** Persister.Recreate( _collection, Id, Session ); } ! else { // this is a normal collection that needs to have its state --- 67,71 ---- Persister.Recreate( _collection, Id, Session ); } ! else { // this is a normal collection that needs to have its state *************** *** 75,80 **** Persister.InsertRows( _collection, Id, Session ); } ! } } ! } --- 75,80 ---- Persister.InsertRows( _collection, Id, Session ); } ! } } ! } \ No newline at end of file |