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 |