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 |