From: Michael D. <mik...@us...> - 2004-11-21 22:58:10
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1408/Persister Modified Files: AbstractEntityPersister.cs EntityPersister.cs NormalizedEntityPersister.cs Log Message: NHibernate is now CLSCompliant Index: NormalizedEntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/NormalizedEntityPersister.cs,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** NormalizedEntityPersister.cs 14 Oct 2004 04:33:14 -0000 1.33 --- NormalizedEntityPersister.cs 21 Nov 2004 22:56:29 -0000 1.34 *************** *** 162,166 **** this.factory = factory; Table table = model.RootTable; ! this.qualifiedTableName = table.GetQualifiedName( dialect, factory.DefaultSchema ); // DISCRIMINATOR --- 162,166 ---- this.factory = factory; Table table = model.RootTable; ! this.qualifiedTableName = table.GetQualifiedName( Dialect, factory.DefaultSchema ); // DISCRIMINATOR *************** *** 206,210 **** foreach(Table tab in model.TableClosureCollection) { ! string tabname = tab.GetQualifiedName( dialect, factory.DefaultSchema ); if ( !tabname.Equals(qualifiedTableName) ) { --- 206,210 ---- foreach(Table tab in model.TableClosureCollection) { ! string tabname = tab.GetQualifiedName( Dialect, factory.DefaultSchema ); if ( !tabname.Equals(qualifiedTableName) ) { *************** *** 214,218 **** foreach(Column col in tab.PrimaryKey.ColumnCollection ) { ! key[k++] = col.GetQuotedName(dialect); } keyColumns.Add(key); --- 214,218 ---- foreach(Column col in tab.PrimaryKey.ColumnCollection ) { ! key[k++] = col.GetQuotedName( Dialect ); } keyColumns.Add(key); *************** *** 235,239 **** foreach(Table tab in model.SubclassTableClosureCollection ) { ! string tabname = tab.GetQualifiedName(dialect, factory.DefaultSchema); if ( !tabname.Equals(qualifiedTableName) ) { subtables.Add(tabname); --- 235,239 ---- foreach(Table tab in model.SubclassTableClosureCollection ) { ! string tabname = tab.GetQualifiedName( Dialect, factory.DefaultSchema ); if ( !tabname.Equals(qualifiedTableName) ) { subtables.Add(tabname); *************** *** 242,246 **** foreach(Column col in tab.PrimaryKey.ColumnCollection ) { ! key[k++] = col.GetQuotedName(dialect); } keyColumns.Add(key); --- 242,246 ---- foreach(Column col in tab.PrimaryKey.ColumnCollection ) { ! key[k++] = col.GetQuotedName( Dialect ); } keyColumns.Add(key); *************** *** 282,286 **** thisClassProperties.Add(prop, thisClassPropertiesObject); Table tab = prop.Value.Table; ! string tabname = tab.GetQualifiedName(dialect, factory.DefaultSchema ); this.propertyTables[propertyIndex] = GetTableId(tabname, this.tableNames); --- 282,286 ---- thisClassProperties.Add(prop, thisClassPropertiesObject); Table tab = prop.Value.Table; ! string tabname = tab.GetQualifiedName( Dialect, factory.DefaultSchema ); this.propertyTables[propertyIndex] = GetTableId(tabname, this.tableNames); *************** *** 294,300 **** foreach(Column col in prop.ColumnCollection ) { ! string colname = col.GetQuotedName(dialect); propCols[columnIndex] = colname; ! propAliases[columnIndex] = col.Alias(dialect, tab.UniqueInteger.ToString() + StringHelper.Underscore); columnIndex++; } --- 294,300 ---- foreach(Column col in prop.ColumnCollection ) { ! string colname = col.GetQuotedName( Dialect ); propCols[columnIndex] = colname; ! propAliases[columnIndex] = col.Alias( Dialect, tab.UniqueInteger.ToString() + StringHelper.Underscore ); columnIndex++; } *************** *** 334,338 **** definedBySubclass.Add( !thisClassProperties.Contains(prop) ); Table tab = prop.Value.Table; ! string tabname = tab.GetQualifiedName( dialect, factory.DefaultSchema ); string[] cols = new string[ prop.ColumnSpan ]; types.Add( prop.Type ); --- 334,338 ---- definedBySubclass.Add( !thisClassProperties.Contains(prop) ); Table tab = prop.Value.Table; ! string tabname = tab.GetQualifiedName( Dialect, factory.DefaultSchema ); string[] cols = new string[ prop.ColumnSpan ]; types.Add( prop.Type ); *************** *** 343,350 **** foreach(Column col in prop.ColumnCollection) { ! columns.Add( col.GetQuotedName(dialect) ); coltables.Add(tabnum); ! cols[l++] = col.GetQuotedName(dialect); ! aliases.Add( col.Alias(dialect, tab.UniqueInteger.ToString() + StringHelper.Underscore ) ); } propColumns.Add(cols); --- 343,350 ---- foreach(Column col in prop.ColumnCollection) { ! columns.Add( col.GetQuotedName( Dialect ) ); coltables.Add(tabnum); ! cols[l++] = col.GetQuotedName( Dialect ); ! aliases.Add( col.Alias( Dialect, tab.UniqueInteger.ToString() + StringHelper.Underscore ) ); } propColumns.Add(cols); *************** *** 397,401 **** this.tableNumbers = new int[subclassSpan]; this.tableNumbers[subclassSpan-1] = GetTableId( ! model.Table.GetQualifiedName( dialect, factory.DefaultSchema ), this.subclassTableNameClosure); --- 397,401 ---- this.tableNumbers = new int[subclassSpan]; this.tableNumbers[subclassSpan-1] = GetTableId( ! model.Table.GetQualifiedName( Dialect, factory.DefaultSchema ), this.subclassTableNameClosure); *************** *** 403,407 **** foreach(Column col in model.Table.PrimaryKey.ColumnCollection) { ! notNullColumns[subclassSpan-1] = col.GetQuotedName(dialect); //only once } } --- 403,407 ---- foreach(Column col in model.Table.PrimaryKey.ColumnCollection) { ! notNullColumns[subclassSpan-1] = col.GetQuotedName( Dialect ); //only once } } *************** *** 425,434 **** discriminatorValues[p] = disc.ToString(); tableNumbers[p] = GetTableId( ! sc.Table.GetQualifiedName( dialect, factory.DefaultSchema ), subclassTableNameClosure ); foreach(Column col in sc.Table.PrimaryKey.ColumnCollection) { ! notNullColumns[p] = col.GetQuotedName(dialect); //only once; } } --- 425,434 ---- discriminatorValues[p] = disc.ToString(); tableNumbers[p] = GetTableId( ! sc.Table.GetQualifiedName( Dialect, factory.DefaultSchema ), subclassTableNameClosure ); foreach(Column col in sc.Table.PrimaryKey.ColumnCollection) { ! notNullColumns[p] = col.GetQuotedName( Dialect ); //only once; } } *************** *** 521,528 **** SqlString lockString = GenerateLockString(null, null); ! SqlString lockExclusiveString = dialect.SupportsForUpdate ? GenerateLockString(lockString, " FOR UPDATE") : GenerateLockString(lockString, null); ! SqlString lockExclusiveNowaitString = dialect.SupportsForUpdateNoWait ? GenerateLockString(lockString, " FOR UPDATE NOWAIT") : GenerateLockString(lockString, null); --- 521,528 ---- SqlString lockString = GenerateLockString(null, null); ! SqlString lockExclusiveString = Dialect.SupportsForUpdate ? GenerateLockString(lockString, " FOR UPDATE") : GenerateLockString(lockString, null); ! SqlString lockExclusiveNowaitString = Dialect.SupportsForUpdateNoWait ? GenerateLockString(lockString, " FOR UPDATE NOWAIT") : GenerateLockString(lockString, null); *************** *** 740,747 **** // make sure the Dialect has an identity insert string because we don't want // to add the column when there is no value to supply the SqlBuilder ! if(dialect.IdentityInsertString!=null) { // only 1 column if there is IdentityInsert enabled. ! builder.AddColumn(naturalOrderTableKeyColumns[j][0], dialect.IdentityInsertString); } } --- 740,747 ---- // make sure the Dialect has an identity insert string because we don't want // to add the column when there is no value to supply the SqlBuilder ! if( Dialect.IdentityInsertString!=null ) { // only 1 column if there is IdentityInsert enabled. ! builder.AddColumn( naturalOrderTableKeyColumns[j][0], Dialect.IdentityInsertString ); } } *************** *** 1088,1094 **** object id; ! if(dialect.SupportsIdentitySelectInInsert) { ! statement = session.Batcher.PrepareCommand( dialect.AddIdentitySelectToInsert(sql[0]) ); idSelect = statement; } --- 1088,1094 ---- object id; ! if( Dialect.SupportsIdentitySelectInInsert ) { ! statement = session.Batcher.PrepareCommand( Dialect.AddIdentitySelectToInsert( sql[0] ) ); idSelect = statement; } *************** *** 1115,1119 **** // if it doesn't support identity select in insert then we have to issue the Insert // as a seperate command here ! if(dialect.SupportsIdentitySelectInInsert==false) { session.Batcher.ExecuteNonQuery( statement ); --- 1115,1119 ---- // if it doesn't support identity select in insert then we have to issue the Insert // as a seperate command here ! if( Dialect.SupportsIdentitySelectInInsert==false ) { session.Batcher.ExecuteNonQuery( statement ); *************** *** 1137,1141 **** finally { ! if( dialect.SupportsIdentitySelectInInsert==false ) { session.Batcher.CloseCommand( statement, null ); --- 1137,1141 ---- finally { ! if( Dialect.SupportsIdentitySelectInInsert==false ) { session.Batcher.CloseCommand( statement, null ); *************** *** 1340,1344 **** string idProp = IdentifierPropertyName; if (idProp!=null) InitPropertyPaths( idProp, IdentifierType, IdentifierColumnNames, 0, mapping ); ! if ( hasEmbeddedIdentifier ) InitPropertyPaths( null, IdentifierType, IdentifierColumnNames, 0, mapping ); InitPropertyPaths( PathExpressionParser.EntityID, IdentifierType, IdentifierColumnNames, 0, mapping ); --- 1340,1344 ---- string idProp = IdentifierPropertyName; if (idProp!=null) InitPropertyPaths( idProp, IdentifierType, IdentifierColumnNames, 0, mapping ); ! if ( HasEmbeddedIdentifier ) InitPropertyPaths( null, IdentifierType, IdentifierColumnNames, 0, mapping ); InitPropertyPaths( PathExpressionParser.EntityID, IdentifierType, IdentifierColumnNames, 0, mapping ); *************** *** 1511,1515 **** private CaseFragment DiscriminatorFragment(string alias) { ! CaseFragment cases = dialect.CreateCaseFragment(); for (int i=0; i<discriminatorValues.Length; i++) --- 1511,1515 ---- private CaseFragment DiscriminatorFragment(string alias) { ! CaseFragment cases = Dialect.CreateCaseFragment(); for (int i=0; i<discriminatorValues.Length; i++) *************** *** 1527,1531 **** { if (tableNumber==0) return name; ! return dialect.QuoteForAliasName(dialect.UnQuote(name) + StringHelper.Underscore + tableNumber); } --- 1527,1531 ---- { if (tableNumber==0) return name; ! return Dialect.QuoteForAliasName( Dialect.UnQuote(name) + StringHelper.Underscore + tableNumber ); } Index: AbstractEntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/AbstractEntityPersister.cs,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** AbstractEntityPersister.cs 21 Sep 2004 09:58:24 -0000 1.26 --- AbstractEntityPersister.cs 21 Nov 2004 22:56:29 -0000 1.27 *************** *** 33,37 **** private System.Type mappedClass; ! [NonSerialized] protected Dialect.Dialect dialect; [NonSerialized] private ConstructorInfo constructor; --- 33,37 ---- private System.Type mappedClass; ! [NonSerialized] private Dialect.Dialect dialect; [NonSerialized] private ConstructorInfo constructor; *************** *** 60,64 **** [NonSerialized] private System.Type concreteProxyClass; [NonSerialized] private bool hasProxy; ! [NonSerialized] protected bool hasEmbeddedIdentifier; [NonSerialized] private string[] identifierColumnNames; --- 60,64 ---- [NonSerialized] private System.Type concreteProxyClass; [NonSerialized] private bool hasProxy; ! [NonSerialized] private bool hasEmbeddedIdentifier; [NonSerialized] private string[] identifierColumnNames; *************** *** 111,115 **** public virtual SqlString IdentifierSelectFragment(string name, string suffix) { ! return new SelectFragment(dialect) .SetSuffix(suffix) .AddColumns( name, IdentifierColumnNames ) --- 111,115 ---- public virtual SqlString IdentifierSelectFragment(string name, string suffix) { ! return new SelectFragment( Dialect ) .SetSuffix(suffix) .AddColumns( name, IdentifierColumnNames ) *************** *** 189,193 **** { object id; ! if (hasEmbeddedIdentifier) { id = obj; --- 189,193 ---- { object id; ! if ( HasEmbeddedIdentifier ) { id = obj; *************** *** 209,213 **** public virtual void SetIdentifier(object obj, object id) { ! if(hasEmbeddedIdentifier) { ComponentType copier = (ComponentType) identifierType; --- 209,213 ---- public virtual void SetIdentifier(object obj, object id) { ! if( HasEmbeddedIdentifier ) { ComponentType copier = (ComponentType) identifierType; *************** *** 227,231 **** public virtual object Instantiate(object id) { ! if (hasEmbeddedIdentifier && id.GetType()==mappedClass) { return id; --- 227,231 ---- public virtual object Instantiate(object id) { ! if ( HasEmbeddedIdentifier && id.GetType()==mappedClass ) { return id; *************** *** 427,431 **** protected AbstractEntityPersister(PersistentClass model, ISessionFactoryImplementor factory) { ! this.dialect = factory.Dialect; // CLASS --- 427,431 ---- protected AbstractEntityPersister(PersistentClass model, ISessionFactoryImplementor factory) { ! dialect = factory.Dialect; // CLASS *************** *** 441,445 **** sqlWhereStringTemplate = sqlWhereString==null ? null : ! Template.RenderWhereStringTemplate(sqlWhereString, dialect); polymorphic = model.IsPolymorphic; --- 441,445 ---- sqlWhereStringTemplate = sqlWhereString==null ? null : ! Template.RenderWhereStringTemplate(sqlWhereString, Dialect); polymorphic = model.IsPolymorphic; *************** *** 513,524 **** foreach(Column col in idValue.ColumnCollection) { ! identifierColumnNames[i] = col.GetQuotedName(dialect); i++; } // GENERATOR ! idgen = model.Identifier.CreateIdentifierGenerator(dialect); useIdentityColumn = idgen is IdentityGenerator; ! identitySelectString = useIdentityColumn ? dialect.IdentitySelectString : null; // UNSAVED-VALUE: --- 513,524 ---- foreach(Column col in idValue.ColumnCollection) { ! identifierColumnNames[i] = col.GetQuotedName( Dialect ); i++; } // GENERATOR ! idgen = model.Identifier.CreateIdentifierGenerator( Dialect ); useIdentityColumn = idgen is IdentityGenerator; ! identitySelectString = useIdentityColumn ? Dialect.IdentitySelectString : null; // UNSAVED-VALUE: *************** *** 559,563 **** foreach(Column col in model.Version.ColumnCollection) { ! versionColumnName = col.GetQuotedName(dialect); //only hapens once } } --- 559,563 ---- foreach(Column col in model.Version.ColumnCollection) { ! versionColumnName = col.GetQuotedName( Dialect ); //only hapens once } } *************** *** 786,790 **** public virtual bool HasIdentifierPropertyOrEmbeddedCompositeIdentifier { ! get { return HasIdentifierProperty || hasEmbeddedIdentifier;} } --- 786,790 ---- public virtual bool HasIdentifierPropertyOrEmbeddedCompositeIdentifier { ! get { return HasIdentifierProperty || HasEmbeddedIdentifier; } } Index: EntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/EntityPersister.cs,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** EntityPersister.cs 21 Sep 2004 09:58:24 -0000 1.30 --- EntityPersister.cs 21 Nov 2004 22:56:29 -0000 1.31 *************** *** 80,84 **** this.factory = factory; Table table = model.RootTable; ! qualifiedTableName = table.GetQualifiedName( dialect, factory.DefaultSchema ); tableNames = new string[] { qualifiedTableName }; --- 80,84 ---- this.factory = factory; Table table = model.RootTable; ! qualifiedTableName = table.GetQualifiedName( Dialect, factory.DefaultSchema ); tableNames = new string[] { qualifiedTableName }; *************** *** 100,104 **** foreach(Column discColumn in d.ColumnCollection) { ! discriminatorColumnName = discColumn.GetQuotedName(dialect); } --- 100,104 ---- foreach(Column discColumn in d.ColumnCollection) { ! discriminatorColumnName = discColumn.GetQuotedName( Dialect ); } *************** *** 163,168 **** foreach(Column col in prop.ColumnCollection) { ! colAliases[j] = col.Alias(dialect); ! colNames[j] = col.GetQuotedName(dialect); j++; if( prop.IsUpdateable ) foundColumn=true; --- 163,168 ---- foreach(Column col in prop.ColumnCollection) { ! colAliases[j] = col.Alias( Dialect ); ! colNames[j] = col.GetQuotedName( Dialect ); j++; if( prop.IsUpdateable ) foundColumn=true; *************** *** 201,205 **** { formulas.Add( prop.Formula.FormulaString ); ! formulaTemplates.Add( prop.Formula.GetTemplate(dialect) ); propColumns.Add( new string[0] ); formulaAliases.Add( prop.Formula.Alias ); --- 201,205 ---- { formulas.Add( prop.Formula.FormulaString ); ! formulaTemplates.Add( prop.Formula.GetTemplate( Dialect ) ); propColumns.Add( new string[0] ); formulaAliases.Add( prop.Formula.Alias ); *************** *** 213,219 **** foreach( Column col in prop.ColumnCollection ) { ! columns.Add( col.GetQuotedName(dialect) ); ! aliases.Add( col.Alias(dialect) ); ! cols[l++] = col.GetQuotedName(dialect); } propColumns.Add(cols); --- 213,219 ---- foreach( Column col in prop.ColumnCollection ) { ! columns.Add( col.GetQuotedName( Dialect ) ); ! aliases.Add( col.Alias( Dialect ) ); ! cols[l++] = col.GetQuotedName( Dialect ); } propColumns.Add(cols); *************** *** 354,361 **** SqlString lockString = GenerateLockString(null, null); ! SqlString lockExclusiveString = dialect.SupportsForUpdate ? GenerateLockString(lockString, " FOR UPDATE") : GenerateLockString(lockString, null); ! SqlString lockExclusiveNowaitString = dialect.SupportsForUpdateNoWait ? GenerateLockString(lockString, " FOR UPDATE NOWAIT") : GenerateLockString(lockString, null); --- 354,361 ---- SqlString lockString = GenerateLockString(null, null); ! SqlString lockExclusiveString = Dialect.SupportsForUpdate ? GenerateLockString(lockString, " FOR UPDATE") : GenerateLockString(lockString, null); ! SqlString lockExclusiveNowaitString = Dialect.SupportsForUpdateNoWait ? GenerateLockString(lockString, " FOR UPDATE NOWAIT") : GenerateLockString(lockString, null); *************** *** 532,539 **** // make sure the Dialect has an identity insert string because we don't want // to add the column when there is no value to supply the SqlBuilder ! if(dialect.IdentityInsertString!=null) { // only 1 column if there is IdentityInsert enabled. ! builder.AddColumn(IdentifierColumnNames[0], dialect.IdentityInsertString); } } --- 532,539 ---- // make sure the Dialect has an identity insert string because we don't want // to add the column when there is no value to supply the SqlBuilder ! if( Dialect.IdentityInsertString!=null ) { // only 1 column if there is IdentityInsert enabled. ! builder.AddColumn( IdentifierColumnNames[0], Dialect.IdentityInsertString ); } } *************** *** 832,838 **** IDataReader rs = null; ! if(dialect.SupportsIdentitySelectInInsert) { ! statement = session.Batcher.PrepareCommand( dialect.AddIdentitySelectToInsert(sql) ); idSelect = statement; } --- 832,838 ---- IDataReader rs = null; ! if( Dialect.SupportsIdentitySelectInInsert ) { ! statement = session.Batcher.PrepareCommand( Dialect.AddIdentitySelectToInsert(sql) ); idSelect = statement; } *************** *** 859,863 **** // if it doesn't support identity select in insert then we have to issue the Insert // as a seperate command here ! if(dialect.SupportsIdentitySelectInInsert==false) { session.Batcher.ExecuteNonQuery( statement ); --- 859,863 ---- // if it doesn't support identity select in insert then we have to issue the Insert // as a seperate command here ! if( Dialect.SupportsIdentitySelectInInsert==false ) { session.Batcher.ExecuteNonQuery( statement ); *************** *** 884,888 **** finally { ! if( dialect.SupportsIdentitySelectInInsert==false ) { session.Batcher.CloseCommand( statement, null ); --- 884,888 ---- finally { ! if( Dialect.SupportsIdentitySelectInInsert==false ) { session.Batcher.CloseCommand( statement, null ); *************** *** 1069,1073 **** string idProp = IdentifierPropertyName; if (idProp!=null) InitPropertyPaths( idProp, IdentifierType, IdentifierColumnNames, mapping ); ! if ( hasEmbeddedIdentifier ) InitPropertyPaths( null, IdentifierType, IdentifierColumnNames, mapping ); InitPropertyPaths( PathExpressionParser.EntityID, IdentifierType, IdentifierColumnNames, mapping ); --- 1069,1073 ---- string idProp = IdentifierPropertyName; if (idProp!=null) InitPropertyPaths( idProp, IdentifierType, IdentifierColumnNames, mapping ); ! if ( HasEmbeddedIdentifier ) InitPropertyPaths( null, IdentifierType, IdentifierColumnNames, mapping ); InitPropertyPaths( PathExpressionParser.EntityID, IdentifierType, IdentifierColumnNames, mapping ); |