Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32738/nhibernate/src/NHibernate/Mapping Modified Files: Any.cs Array.cs Bag.cs Collection.cs Column.cs Component.cs Constraint.cs ForeignKey.cs Formula.cs IRelationalModel.cs IdentifierBag.cs IdentifierCollection.cs Index.cs List.cs ManyToOne.cs Map.cs OneToOne.cs PrimaryKey.cs Property.cs RootClass.cs Set.cs SimpleValue.cs Table.cs ToOne.cs UniqueKey.cs Log Message: Bringing mapping/config to 2.1 feature set - excludes metaData Index: ManyToOne.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/ManyToOne.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ManyToOne.cs 1 Mar 2005 16:24:49 -0000 1.5 --- ManyToOne.cs 14 Mar 2005 14:36:26 -0000 1.6 *************** *** 20,24 **** /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName ) { try --- 20,25 ---- /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! /// <param name="propertyAccess"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName, string propertyAccess ) { try *************** *** 26,30 **** if( Type == null ) { ! Type = TypeFactory.ManyToOne( ReflectHelper.GetGetter( propertyClass, propertyName ).ReturnType ); } } --- 27,31 ---- if( Type == null ) { ! Type = TypeFactory.ManyToOne( ReflectHelper.GetGetter( propertyClass, propertyName, propertyAccess ).ReturnType ); } } Index: Map.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Map.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Map.cs 1 Mar 2005 16:24:49 -0000 1.8 --- Map.cs 14 Mar 2005 14:36:26 -0000 1.9 *************** *** 26,36 **** /// <summary></summary> ! public override System.Type WrapperClass { ! get { ! return IsSorted ? ! typeof( NHibernate.Collection.SortedMap ) : ! typeof( NHibernate.Collection.Map ); } } --- 26,35 ---- /// <summary></summary> ! public override void CreateAllKeys( ) { ! base.CreateAllKeys(); ! if ( !IsInverse ) { ! Index.CreateForeignKey(); } } Index: Formula.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Formula.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Formula.cs 2 Jan 2005 22:03:39 -0000 1.5 --- Formula.cs 14 Mar 2005 14:36:26 -0000 1.6 *************** *** 11,15 **** private string formula; - private int uniqueInteger; --- 11,14 ---- Index: Property.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Property.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Property.cs 8 Mar 2005 16:49:24 -0000 1.12 --- Property.cs 14 Mar 2005 14:36:26 -0000 1.13 *************** *** 112,115 **** --- 112,117 ---- else if( cascade.Equals( "all-delete-orphan" ) ) { + // TODO: 2.1 - Reintroduce when Loader porting completed + //return Cascades.CascadeStyle.StyleAllDeleteOrphan; return Cascades.CascadeStyle.StyleAllGC; } *************** *** 126,129 **** --- 128,137 ---- return Cascades.CascadeStyle.StyleOnlyDelete; } + else if( cascade.Equals( "delete-orphan" ) ) + { + // TODO: 2.1 - Reintroduce when Loader porting completed + //return Cascades.CascadeStyle.StyleDeleteOrphan; + return Cascades.CascadeStyle.StyleOnlyDelete; + } else { *************** *** 163,168 **** public bool IsNullable { ! // Approximate ! get { return propertyValue != null && propertyValue.IsNullable; } } --- 171,175 ---- public bool IsNullable { ! get { return propertyValue == null || propertyValue.IsNullable; } } Index: Column.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Column.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Column.cs 19 Feb 2005 15:13:52 -0000 1.17 --- Column.cs 14 Mar 2005 14:36:26 -0000 1.18 *************** *** 17,21 **** private int length = DefaultPropertyLength; private IType type; ! private int typeIndex; private string name; private bool nullable = true; --- 17,21 ---- private int length = DefaultPropertyLength; private IType type; ! private int typeIndex = 0; private string name; private bool nullable = true; *************** *** 23,26 **** --- 23,27 ---- private string sqlType; private bool quoted = false; + private string checkConstraint; /// <summary></summary> *************** *** 111,115 **** public string Alias( Dialect.Dialect d ) { ! if( quoted ) { return "y" + uniqueInteger.ToString() + StringHelper.Underscore; --- 112,116 ---- public string Alias( Dialect.Dialect d ) { ! if( quoted || name[0] == StringHelper.SingleQuote || char.IsDigit( name, 0 ) ) { return "y" + uniqueInteger.ToString() + StringHelper.Underscore; *************** *** 136,140 **** public string Alias( Dialect.Dialect d, string suffix ) { ! if( quoted ) { return "y" + uniqueInteger.ToString() + StringHelper.Underscore; --- 137,141 ---- public string Alias( Dialect.Dialect d, string suffix ) { ! if( quoted || name[0] == StringHelper.SingleQuote || char.IsDigit( name, 0 ) ) { return "y" + uniqueInteger.ToString() + StringHelper.Underscore; *************** *** 322,325 **** --- 323,351 ---- } + /// <summary> + /// Gets or sets whether the column is unique. + /// </summary> + public bool Unique + { + get { return unique; } + set { unique = value; } + } + + /// <summary> + /// Gets or sets a check constraint on the column + /// </summary> + public string CheckConstraint + { + get { return checkConstraint; } + set { checkConstraint = value; } + } + + /// <summary> + /// Do we have a check constraint? + /// </summary> + public bool HasCheckConstraint + { + get { return checkConstraint != null && checkConstraint.Length > 0; } + } } } \ No newline at end of file Index: Collection.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Collection.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Collection.cs 1 Mar 2005 16:24:49 -0000 1.8 --- Collection.cs 14 Mar 2005 14:36:26 -0000 1.9 *************** *** 23,29 **** private string role; private bool lazy; - //private bool isOneToMany; private bool inverse; - //private OneToMany oneToMany; private ICacheConcurrencyStrategy cache; private string orderBy; --- 23,27 ---- *************** *** 167,173 **** /// <summary></summary> - public abstract System.Type WrapperClass { get; } - - /// <summary></summary> public virtual bool IsPrimitiveArray { --- 165,168 ---- *************** *** 191,206 **** { get { return element is OneToMany; } - //set { isOneToMany = value; } } - /* - /// <summary></summary> - public OneToMany OneToMany - { - get { return oneToMany; } - set { oneToMany = value; } - } - */ - /// <summary></summary> public ICacheConcurrencyStrategy Cache --- 186,191 ---- *************** *** 282,286 **** /// /// </summary> ! public void CreateAllKeys() { CreateForeignKeys(); --- 267,271 ---- /// /// </summary> ! public virtual void CreateAllKeys() { CreateForeignKeys(); Index: RootClass.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/RootClass.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** RootClass.cs 1 Mar 2005 16:24:49 -0000 1.13 --- RootClass.cs 14 Mar 2005 14:36:26 -0000 1.14 *************** *** 3,6 **** --- 3,7 ---- using log4net; using NHibernate.Cache; + using NHibernate.Engine; using NHibernate.Persister; *************** *** 38,42 **** private bool forceDiscriminator; private string where; ! private bool discriminatorInsertable; /// <summary> --- 39,43 ---- private bool forceDiscriminator; private string where; ! private bool discriminatorInsertable = true; /// <summary> *************** *** 319,322 **** --- 320,336 ---- set { discriminatorInsertable = value; } } + + /// <summary> + /// + /// </summary> + /// <param name="mapping"></param> + public override void Validate( IMapping mapping ) + { + base.Validate( mapping ); + if ( !Identifier.IsValid( mapping ) ) + { + throw new MappingException( string.Format( "identifier mapping has wrong number of columns: {0} type: {1}", MappedClass.Name, Identifier.Type.Name ) ); + } + } } } \ No newline at end of file Index: Constraint.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Constraint.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Constraint.cs 9 Feb 2005 03:09:38 -0000 1.7 --- Constraint.cs 14 Mar 2005 14:36:26 -0000 1.8 *************** *** 77,86 **** /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <returns> /// A string that contains the SQL to drop this Constraint. /// </returns> ! public virtual string SqlDropString( Dialect.Dialect dialect ) { ! return "alter table " + Table.GetQualifiedName( dialect ) + " drop constraint " + Name; } --- 77,88 ---- /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to drop this Constraint. /// </returns> ! public virtual string SqlDropString( Dialect.Dialect dialect, string defaultSchema ) { ! // TODO: NH 1.0+ - Get this string from the dialect ! return string.Format( "alter table {0} drop constraint {1}", Table.GetQualifiedName( dialect, defaultSchema ), Name ); } *************** *** 90,102 **** /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="p"></param> /// <returns> /// A string that contains the SQL to create this Constraint. /// </returns> ! public string SqlCreateString( Dialect.Dialect dialect, IMapping p ) { ! StringBuilder buf = new StringBuilder( "alter table " ) ! .Append( Table.GetQualifiedName( dialect ) ) ! .Append( SqlConstraintString( dialect, Name ) ); ! return buf.ToString(); } --- 92,103 ---- /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="p"></param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to create this Constraint. /// </returns> ! public string SqlCreateString( Dialect.Dialect dialect, IMapping p, string defaultSchema ) { ! // TODO: NH 1.0+ - Get this string from the dialect ! return string.Format( "alter table {0} {1} ", Table.GetQualifiedName( dialect, defaultSchema ), SqlConstraintString( dialect, Name, defaultSchema ) ); } *************** *** 109,116 **** /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="constraintName">The name to use as the identifier of the constraint in the database.</param> /// <returns> /// A string that contains the SQL to create the named Constraint. /// </returns> ! public abstract string SqlConstraintString( Dialect.Dialect d, string constraintName ); } --- 110,118 ---- /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="constraintName">The name to use as the identifier of the constraint in the database.</param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to create the named Constraint. /// </returns> ! public abstract string SqlConstraintString( Dialect.Dialect d, string constraintName, string defaultSchema ); } Index: ToOne.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/ToOne.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ToOne.cs 1 Mar 2005 16:24:49 -0000 1.1 --- ToOne.cs 14 Mar 2005 14:36:26 -0000 1.2 *************** *** 43,47 **** /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! public abstract override void SetTypeByReflection( System.Type propertyClass, string propertyName ); } } --- 43,48 ---- /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! /// <param name="propertyAccess"></param> ! public abstract override void SetTypeByReflection( System.Type propertyClass, string propertyName, string propertyAccess ); } } Index: PrimaryKey.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/PrimaryKey.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PrimaryKey.cs 9 Feb 2005 03:09:39 -0000 1.8 --- PrimaryKey.cs 14 Mar 2005 14:36:26 -0000 1.9 *************** *** 13,20 **** /// </summary> /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <returns> /// A string that contains the SQL to create the Primary Key Constraint. /// </returns> ! public string SqlConstraintString( Dialect.Dialect d ) { StringBuilder buf = new StringBuilder( " primary key (" ); --- 13,21 ---- /// </summary> /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to create the Primary Key Constraint. /// </returns> ! public string SqlConstraintString( Dialect.Dialect d, string defaultSchema ) { StringBuilder buf = new StringBuilder( " primary key (" ); *************** *** 37,44 **** /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="constraintName">The name to use as the identifier of the constraint in the database.</param> /// <returns> /// A string that contains the SQL to create the named Primary Key Constraint. /// </returns> ! public override string SqlConstraintString( Dialect.Dialect d, string constraintName ) { StringBuilder buf = new StringBuilder( --- 38,46 ---- /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="constraintName">The name to use as the identifier of the constraint in the database.</param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to create the named Primary Key Constraint. /// </returns> ! public override string SqlConstraintString( Dialect.Dialect d, string constraintName, string defaultSchema ) { StringBuilder buf = new StringBuilder( *************** *** 64,73 **** /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> ! /// <returns> /// A string that contains the SQL to drop this Constraint. /// </returns> ! public override string SqlDropString(NHibernate.Dialect.Dialect dialect) { ! return "alter table " + Table.GetQualifiedName( dialect ) + dialect.GetDropPrimaryKeyConstraintString( Name ); } #endregion --- 66,76 ---- /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> ! /// <param name="defaultSchema"></param> ! /// <returns> /// A string that contains the SQL to drop this Constraint. /// </returns> ! public override string SqlDropString(NHibernate.Dialect.Dialect dialect, string defaultSchema ) { ! return "alter table " + Table.GetQualifiedName( dialect, defaultSchema ) + dialect.GetDropPrimaryKeyConstraintString( Name ); } #endregion Index: IRelationalModel.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/IRelationalModel.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IRelationalModel.cs 2 Jan 2005 22:03:39 -0000 1.4 --- IRelationalModel.cs 14 Mar 2005 14:36:26 -0000 1.5 *************** *** 14,21 **** /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="p"></param> /// <returns> /// A string that contains the SQL to create an object. /// </returns> ! string SqlCreateString( Dialect.Dialect dialect, IMapping p ); /// <summary> --- 14,22 ---- /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="p"></param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to create an object. /// </returns> ! string SqlCreateString( Dialect.Dialect dialect, IMapping p, string defaultSchema ); /// <summary> *************** *** 24,31 **** /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <returns> /// A string that contains the SQL to drop an object. /// </returns> ! string SqlDropString( Dialect.Dialect dialect ); } } \ No newline at end of file --- 25,33 ---- /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to drop an object. /// </returns> ! string SqlDropString( Dialect.Dialect dialect, string defaultSchema ); } } \ No newline at end of file Index: Component.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Component.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Component.cs 1 Mar 2005 16:24:49 -0000 1.7 --- Component.cs 14 Mar 2005 14:36:26 -0000 1.8 *************** *** 9,18 **** private ArrayList properties = new ArrayList(); private System.Type componentClass; - // TODO: H2.0.3 - make sure this is gone from the mapping file... - //private BasicDynaClass dynaClass - private bool dynamic; private bool embedded; private string parentProperty; private PersistentClass owner; /// <summary></summary> --- 9,16 ---- private ArrayList properties = new ArrayList(); private System.Type componentClass; private bool embedded; private string parentProperty; private PersistentClass owner; + private bool dynamic; /// <summary></summary> *************** *** 97,101 **** /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName ) { } --- 95,100 ---- /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! /// <param name="propertyAccess"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName, string propertyAccess ) { } *************** *** 116,125 **** /// <summary></summary> - public override bool IsComposite - { - get { return true; } - } - - /// <summary></summary> public System.Type ComponentClass { --- 115,118 ---- *************** *** 147,152 **** get { return properties; } } - - } } \ No newline at end of file --- 140,143 ---- Index: OneToOne.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/OneToOne.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** OneToOne.cs 1 Mar 2005 16:24:49 -0000 1.5 --- OneToOne.cs 14 Mar 2005 14:36:26 -0000 1.6 *************** *** 27,31 **** /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName ) { try --- 27,32 ---- /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! /// <param name="propertyAccess"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName, string propertyAccess ) { try *************** *** 33,37 **** if( Type == null ) { ! Type = TypeFactory.OneToOne( ReflectHelper.GetGetter( propertyClass, propertyName ).ReturnType, foreignKeyType ); } } --- 34,38 ---- if( Type == null ) { ! Type = TypeFactory.OneToOne( ReflectHelper.GetGetter( propertyClass, propertyName, propertyAccess ).ReturnType, foreignKeyType ); } } *************** *** 48,51 **** --- 49,53 ---- if( constrained ) { + // TODO: 2.1+ handle the case of a foreign key to something other than the pk CreateForeignKeyOfClass( ( ( EntityType ) Type ).AssociatedClass ); } Index: UniqueKey.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/UniqueKey.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** UniqueKey.cs 9 Feb 2005 03:09:39 -0000 1.8 --- UniqueKey.cs 14 Mar 2005 14:36:26 -0000 1.9 *************** *** 41,48 **** /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="constraintName"></param> /// <returns> /// A string that contains the SQL to create the Unique Key Constraint. /// </returns> ! public override string SqlConstraintString( Dialect.Dialect d, string constraintName ) { StringBuilder buf = new StringBuilder( --- 41,49 ---- /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="constraintName"></param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to create the Unique Key Constraint. /// </returns> ! public override string SqlConstraintString( Dialect.Dialect d, string constraintName, string defaultSchema ) { StringBuilder buf = new StringBuilder( *************** *** 73,82 **** /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> ! /// <returns> /// A string that contains the SQL to drop this Constraint. /// </returns> ! public override string SqlDropString(NHibernate.Dialect.Dialect dialect) { ! return "alter table " + Table.GetQualifiedName( dialect ) + dialect.GetDropIndexConstraintString( Name ); } --- 74,84 ---- /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> ! /// <param name="defaultSchema"></param> ! /// <returns> /// A string that contains the SQL to drop this Constraint. /// </returns> ! public override string SqlDropString(NHibernate.Dialect.Dialect dialect, string defaultSchema ) { ! return "alter table " + Table.GetQualifiedName( dialect, defaultSchema ) + dialect.GetDropIndexConstraintString( Name ); } Index: Any.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Any.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Any.cs 1 Mar 2005 16:24:48 -0000 1.6 --- Any.cs 14 Mar 2005 14:36:26 -0000 1.7 *************** *** 45,49 **** /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName ) { } --- 45,50 ---- /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! /// <param name="propertyAccess"></param> ! public override void SetTypeByReflection( System.Type propertyClass, string propertyName, string propertyAccess ) { } Index: Set.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Set.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Set.cs 1 Mar 2005 16:24:49 -0000 1.8 --- Set.cs 14 Mar 2005 14:36:26 -0000 1.9 *************** *** 39,55 **** } - /// <summary> - /// <see cref="Collection.WrapperClass"/> - /// </summary> - public override System.Type WrapperClass - { - get - { - return IsSorted ? - typeof( NHibernate.Collection.SortedSet ) : - typeof( NHibernate.Collection.Set ); - } - } - /// <summary></summary> public override void CreatePrimaryKey() --- 39,42 ---- Index: IdentifierCollection.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/IdentifierCollection.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IdentifierCollection.cs 1 Mar 2005 16:24:49 -0000 1.4 --- IdentifierCollection.cs 14 Mar 2005 14:36:26 -0000 1.5 *************** *** 1,2 **** --- 1,4 ---- + using NHibernate.Engine; + namespace NHibernate.Mapping { *************** *** 44,50 **** } //else // Create an index on the key columns? - } } } \ No newline at end of file --- 46,63 ---- } //else // Create an index on the key columns? } + /// <summary> + /// + /// </summary> + /// <param name="mapping"></param> + public override void Validate( IMapping mapping ) + { + base.Validate( mapping ); + if ( !Identifier.IsValid( mapping ) ) + { + throw new MappingException( string.Format( "collection id mapping has wrong number of columns: {0} type: {1}", Role, Identifier.Type.Name ) ); + } + } } } \ No newline at end of file Index: SimpleValue.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/SimpleValue.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SimpleValue.cs 1 Mar 2005 16:24:49 -0000 1.1 --- SimpleValue.cs 14 Mar 2005 14:36:26 -0000 1.2 *************** *** 113,118 **** public void CreateForeignKeyOfClass( System.Type persistentClass ) { ! ForeignKey fk = table.CreateForeignKey( ConstraintColumns ); ! fk.ReferencedClass = persistentClass; } --- 113,117 ---- public void CreateForeignKeyOfClass( System.Type persistentClass ) { ! table.CreateForeignKey( ForeignKeyName, ConstraintColumns, persistentClass ); } *************** *** 137,141 **** /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! public virtual void SetTypeByReflection( System.Type propertyClass, string propertyName ) { try --- 136,151 ---- /// <param name="propertyClass"></param> /// <param name="propertyName"></param> ! public void SetTypeByReflection( System.Type propertyClass, string propertyName ) ! { ! SetTypeByReflection( propertyClass, propertyName, "property" ); ! } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="propertyClass"></param> ! /// <param name="propertyName"></param> ! /// <param name="propertyAccess"></param> ! public virtual void SetTypeByReflection( System.Type propertyClass, string propertyName, string propertyAccess ) { try *************** *** 143,147 **** if( type == null ) { ! type = ReflectHelper.ReflectedPropertyType( propertyClass, propertyName ); int count = 0; foreach( Column col in ColumnCollection ) --- 153,157 ---- if( type == null ) { ! type = ReflectHelper.ReflectedPropertyType( propertyClass, propertyName, propertyAccess ); int count = 0; foreach( Column col in ColumnCollection ) Index: Index.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Index.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Index.cs 2 Jan 2005 22:03:39 -0000 1.6 --- Index.cs 14 Mar 2005 14:36:26 -0000 1.7 *************** *** 20,28 **** /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="p"></param> /// <returns> /// A string that contains the SQL to create this Index. /// </returns> ! public string SqlCreateString( Dialect.Dialect dialect, IMapping p ) { StringBuilder buf = new StringBuilder( "create index " ) .Append( dialect.QualifyIndexName ? name : StringHelper.Unqualify( name ) ) --- 20,30 ---- /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="p"></param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to create this Index. /// </returns> ! public string SqlCreateString( Dialect.Dialect dialect, IMapping p, string defaultSchema ) { + // TODO: NH 1.0+ Get these string from the dialect StringBuilder buf = new StringBuilder( "create index " ) .Append( dialect.QualifyIndexName ? name : StringHelper.Unqualify( name ) ) *************** *** 51,60 **** /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <returns> /// A string that contains the SQL to drop this Index. /// </returns> ! public string SqlDropString( Dialect.Dialect dialect ) { ! return "drop index " + table.GetQualifiedName( dialect ) + StringHelper.Dot + name; } --- 53,64 ---- /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to drop this Index. /// </returns> ! public string SqlDropString( Dialect.Dialect dialect, string defaultSchema ) { ! // TODO: NH 1.0+ Get this string from the dialect ! return string.Format( "drop index {0}.{1}", table.GetQualifiedName( dialect, defaultSchema ), name ); } Index: Array.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Array.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Array.cs 1 Mar 2005 16:24:49 -0000 1.5 --- Array.cs 14 Mar 2005 14:36:26 -0000 1.6 *************** *** 33,48 **** /// <summary></summary> - public override System.Type WrapperClass - { - get { return typeof( ArrayHolder ); } - } - - /// <summary></summary> public override bool IsArray { get { return true; } } - - } } \ No newline at end of file --- 33,40 ---- Index: ForeignKey.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/ForeignKey.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ForeignKey.cs 9 Feb 2005 03:09:39 -0000 1.8 --- ForeignKey.cs 14 Mar 2005 14:36:26 -0000 1.9 *************** *** 23,30 **** /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="constraintName">The name to use as the identifier of the constraint in the database.</param> /// <returns> /// A string that contains the SQL to create the named Foreign Key Constraint. /// </returns> ! public override string SqlConstraintString( Dialect.Dialect d, string constraintName ) { string[ ] cols = new string[ColumnSpan]; --- 23,31 ---- /// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="constraintName">The name to use as the identifier of the constraint in the database.</param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to create the named Foreign Key Constraint. /// </returns> ! public override string SqlConstraintString( Dialect.Dialect d, string constraintName, string defaultSchema ) { string[ ] cols = new string[ColumnSpan]; *************** *** 45,49 **** } ! return d.GetAddForeignKeyConstraintString( constraintName, cols, referencedTable.GetQualifiedName( d ), refcols ); } --- 46,50 ---- } ! return d.GetAddForeignKeyConstraintString( constraintName, cols, referencedTable.GetQualifiedName( d, defaultSchema ), refcols ); } *************** *** 96,105 **** /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> ! /// <returns> /// A string that contains the SQL to drop this Constraint. /// </returns> ! public override string SqlDropString(NHibernate.Dialect.Dialect dialect) { ! return "alter table " + Table.GetQualifiedName( dialect ) + dialect.GetDropForeignKeyConstraintString( Name ); } --- 97,108 ---- /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> ! /// <param name="defaultSchema"></param> ! /// <returns> /// A string that contains the SQL to drop this Constraint. /// </returns> ! public override string SqlDropString(NHibernate.Dialect.Dialect dialect, string defaultSchema ) { ! // TODO: NH 1.0+ Get this from the Dialect ! return string.Format( "alter table {0} {1}", Table.GetQualifiedName( dialect, defaultSchema ), dialect.GetDropForeignKeyConstraintString( Name ) ); } Index: List.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/List.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** List.cs 1 Mar 2005 16:24:49 -0000 1.9 --- List.cs 14 Mar 2005 14:36:26 -0000 1.10 *************** *** 21,31 **** get { return TypeFactory.List( Role ); } } - - /// <summary></summary> - public override System.Type WrapperClass - { - get { return typeof( NHibernate.Collection.List ); } - } - } } \ No newline at end of file --- 21,24 ---- Index: Bag.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Bag.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Bag.cs 1 Mar 2005 16:24:49 -0000 1.7 --- Bag.cs 14 Mar 2005 14:36:26 -0000 1.8 *************** *** 22,31 **** } - /// <summary></summary> - public override System.Type WrapperClass - { - get { return typeof( NHibernate.Collection.Bag ); } - } - /// <summary> /// --- 22,25 ---- Index: IdentifierBag.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/IdentifierBag.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** IdentifierBag.cs 1 Mar 2005 16:24:49 -0000 1.5 --- IdentifierBag.cs 14 Mar 2005 14:36:26 -0000 1.6 *************** *** 22,32 **** get { return TypeFactory.IdBag( Role ); } } - - /// <summary></summary> - public override System.Type WrapperClass - { - get { return typeof( NHibernate.Collection.IdentifierBag ); } - } - } } \ No newline at end of file --- 22,25 ---- Index: Table.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Table.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Table.cs 1 Mar 2005 16:24:49 -0000 1.16 --- Table.cs 14 Mar 2005 14:36:26 -0000 1.17 *************** *** 1,6 **** - using System; using System.Collections; using System.Data; using System.Text; using NHibernate.Engine; using NHibernate.Id; --- 1,6 ---- using System.Collections; using System.Data; using System.Text; + using NHibernate.Cfg; using NHibernate.Engine; using NHibernate.Id; *************** *** 258,269 **** /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="p"></param> /// <returns> /// A string that contains the SQL to create this Table, Primary Key Constraints /// , and Unique Key Constraints. /// </returns> ! public string SqlCreateString( Dialect.Dialect dialect, IMapping p ) { StringBuilder buf = new StringBuilder( "create table " ) ! .Append( GetQualifiedName( dialect ) ) .Append( " (" ); --- 258,270 ---- /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="p"></param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to create this Table, Primary Key Constraints /// , and Unique Key Constraints. /// </returns> ! public string SqlCreateString( Dialect.Dialect dialect, IMapping p, string defaultSchema ) { StringBuilder buf = new StringBuilder( "create table " ) ! .Append( GetQualifiedName( dialect, defaultSchema ) ) .Append( " (" ); *************** *** 330,334 **** // //ugly hack... //} else { ! buf.Append( ',' ).Append( primaryKey.SqlConstraintString( dialect ) ); //} } --- 331,335 ---- // //ugly hack... //} else { ! buf.Append( ',' ).Append( primaryKey.SqlConstraintString( dialect, defaultSchema ) ); //} } *************** *** 348,358 **** /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <returns> /// A string that contains the SQL to drop this Table and to cascade the drop to /// the constraints if the database supports it. /// </returns> ! public string SqlDropString( Dialect.Dialect dialect ) { ! return "drop table " + GetQualifiedName( dialect ) + dialect.CascadeConstraintsString; } --- 349,361 ---- /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> + /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to drop this Table and to cascade the drop to /// the constraints if the database supports it. /// </returns> ! public string SqlDropString( Dialect.Dialect dialect, string defaultSchema ) { ! // TODO: NH 1.0+ Get this from the dialect ! return "drop table " + GetQualifiedName( dialect, defaultSchema ) + dialect.CascadeConstraintsString; } *************** *** 416,420 **** --- 419,425 ---- /// Create a <see cref="ForeignKey"/> for the columns in the Table. /// </summary> + /// <param name="keyName"></param> /// <param name="columns">An <see cref="IList"/> of <see cref="Column"/> objects.</param> + /// <param name="referencedClass"></param> /// <returns> /// A <see cref="ForeignKey"/> for the columns in the Table. *************** *** 425,439 **** /// existing <see cref="ForeignKey"/>. /// </remarks> ! public ForeignKey CreateForeignKey( IList columns ) { ! string name = "FK" + UniqueColumnString( columns ); ! ForeignKey fk = ( ForeignKey ) foreignKeys[ name ]; if( fk == null ) { fk = new ForeignKey(); ! fk.Name = name; fk.Table = this; ! foreignKeys.Add( name, fk ); } --- 430,457 ---- /// existing <see cref="ForeignKey"/>. /// </remarks> ! public ForeignKey CreateForeignKey( string keyName, IList columns, System.Type referencedClass ) { ! if ( keyName == null ) ! { ! keyName = "FK" + UniqueColumnString( columns ); ! } ! ForeignKey fk = ( ForeignKey ) foreignKeys[ keyName ]; if( fk == null ) { fk = new ForeignKey(); ! fk.Name = keyName; fk.Table = this; ! fk.ReferencedClass = referencedClass; ! foreignKeys.Add( keyName, fk ); ! } ! else ! { ! // "X"= hexadecimal format ! keyName += referencedClass.Name.GetHashCode().ToString( "X" ).ToUpper(); ! if ( fk.ReferencedClass != referencedClass ) ! { ! fk = CreateForeignKey( keyName, columns, referencedClass ); ! } } |