From: Michael D. <mik...@us...> - 2004-04-13 18:12:15
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24476 Modified Files: PersistentClass.cs RootClass.cs Subclass.cs Table.cs Log Message: synch with H2.0.3 Index: RootClass.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/RootClass.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RootClass.cs 10 Feb 2004 18:35:30 -0000 1.6 --- RootClass.cs 13 Apr 2004 17:58:11 -0000 1.7 *************** *** 3,10 **** using NHibernate.Cache; ! namespace NHibernate.Mapping { ! ! public class RootClass : PersistentClass { private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(RootClass)); public const string DefaultIdentifierColumnName = "id"; public const string DefaultDiscriminatorColumnName = "class"; --- 3,12 ---- using NHibernate.Cache; ! namespace NHibernate.Mapping ! { ! public class RootClass : PersistentClass ! { private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(RootClass)); + public const string DefaultIdentifierColumnName = "id"; public const string DefaultDiscriminatorColumnName = "class"; *************** *** 21,43 **** private System.Type persister; private bool forceDiscriminator; ! public override Property IdentifierProperty { get { return identifierProperty; } set { identifierProperty = value; } } ! public override Value Identifier { get { return identifier; } set { identifier = value; } } ! public override bool HasIdentifierProperty { get { return identifierProperty != null; } } ! public override Value Discriminator { get { return discriminator; } set { discriminator = value; } } ! public override bool IsInherited { get { return false; } } --- 23,53 ---- private System.Type persister; private bool forceDiscriminator; + private string where; ! public override Property IdentifierProperty ! { get { return identifierProperty; } set { identifierProperty = value; } } ! ! public override Value Identifier ! { get { return identifier; } set { identifier = value; } } ! ! public override bool HasIdentifierProperty ! { get { return identifierProperty != null; } } ! public override Value Discriminator ! { get { return discriminator; } set { discriminator = value; } } ! public override bool IsInherited ! { get { return false; } } *************** *** 50,62 **** /// through any other method - so no setter is declared for this property. /// </remarks> ! public override bool IsPolymorphic { get { return polymorphic; } - //set { polymorphic = value; } } ! public override RootClass RootClazz { get { return this; } } ! public override ICollection PropertyClosureCollection { get { return PropertyCollection; } } --- 60,75 ---- /// through any other method - so no setter is declared for this property. /// </remarks> ! public override bool IsPolymorphic ! { get { return polymorphic; } } ! public override RootClass RootClazz ! { get { return this; } } ! ! public override ICollection PropertyClosureCollection ! { get { return PropertyCollection; } } *************** *** 67,74 **** /// <remarks> /// The RootClass should only have one item in the Collection - the Table that it comes from. - /// TODO: why an ICollection - I don't know why the signature calls for an ICollection. /// </remarks> ! public override ICollection TableClosureCollection { ! get { ArrayList retVal = new ArrayList(); retVal.Add( Table ); --- 80,88 ---- /// <remarks> /// The RootClass should only have one item in the Collection - the Table that it comes from. /// </remarks> ! public override ICollection TableClosureCollection ! { ! get ! { ArrayList retVal = new ArrayList(); retVal.Add( Table ); *************** *** 76,134 **** } } ! public override void AddSubclass(Subclass subclass) { base.AddSubclass(subclass); polymorphic = true; } ! public override bool IsExplicitPolymorphism { get { return explicitPolymorphism; } set { explicitPolymorphism = value; } } ! public override Property Version { get { return version; } set { version = value; } } ! public override bool IsVersioned { get { return version != null; } } ! public override ICacheConcurrencyStrategy Cache { get { return cache; } set { cache = value; } } ! public override bool IsMutable { get { return mutable; } set { mutable = value; } } ! public override bool HasEmbeddedIdentifier { get { return embeddedIdentifier; } set { embeddedIdentifier = value; } } ! public override System.Type Persister { get { return persister; } set { persister = value; } } ! public override Table RootTable { get { return Table; } } ! public override PersistentClass Superclass { get { return null; } ! set { throw new InvalidOperationException(); } } ! public override Value Key { get { return Identifier; } set { throw new InvalidOperationException(); } } ! public override bool IsForceDiscriminator { get { return forceDiscriminator; } set { this.forceDiscriminator = value; } } } } --- 90,170 ---- } } ! ! public override void AddSubclass(Subclass subclass) ! { base.AddSubclass(subclass); polymorphic = true; } ! public override bool IsExplicitPolymorphism ! { get { return explicitPolymorphism; } set { explicitPolymorphism = value; } } ! public override Property Version ! { get { return version; } set { version = value; } } ! ! public override bool IsVersioned ! { get { return version != null; } } ! public override ICacheConcurrencyStrategy Cache ! { get { return cache; } set { cache = value; } } ! public override bool IsMutable ! { get { return mutable; } set { mutable = value; } } ! ! public override bool HasEmbeddedIdentifier ! { get { return embeddedIdentifier; } set { embeddedIdentifier = value; } } ! public override System.Type Persister ! { get { return persister; } set { persister = value; } } ! public override Table RootTable ! { get { return Table; } } ! public override PersistentClass Superclass ! { get { return null; } ! set { throw new InvalidOperationException("Can not set the Superclass on a RootClass."); } } ! public override Value Key ! { get { return Identifier; } set { throw new InvalidOperationException(); } } ! public override bool IsForceDiscriminator ! { get { return forceDiscriminator; } set { this.forceDiscriminator = value; } } + + public override string Where + { + get { return where; } + set { where = value; } + } + } } Index: Table.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Table.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Table.cs 13 Apr 2004 02:35:21 -0000 1.9 --- Table.cs 13 Apr 2004 17:58:11 -0000 1.10 *************** *** 212,216 **** { //if ( dialect is HSQLDialect && identityColumn ) { ! // //ugly hack... //} else { buf.Append(',').Append( primaryKey.SqlConstraintString(dialect) ); --- 212,217 ---- { //if ( dialect is HSQLDialect && identityColumn ) { ! // // skip the primary key definition ! // //ugly hack... //} else { buf.Append(',').Append( primaryKey.SqlConstraintString(dialect) ); *************** *** 272,276 **** ForeignKey fk = (ForeignKey) foreignKeys[name]; ! if (fk == null) { fk = new ForeignKey(); fk.Name = name; --- 273,278 ---- ForeignKey fk = (ForeignKey) foreignKeys[name]; ! if (fk == null) ! { fk = new ForeignKey(); fk.Name = name; *************** *** 296,300 **** // this is marked as unchecked because the GetHashCode could potentially // cause an integer overflow. This way if there is an overflow it will ! // just roll back over. unchecked{ result += obj.GetHashCode(); } } --- 298,303 ---- // this is marked as unchecked because the GetHashCode could potentially // cause an integer overflow. This way if there is an overflow it will ! // just roll back over - since we are not doing any computations based ! // on this number then a rollover is no big deal. unchecked{ result += obj.GetHashCode(); } } Index: Subclass.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Subclass.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Subclass.cs 10 Feb 2004 18:35:30 -0000 1.4 --- Subclass.cs 13 Apr 2004 17:58:11 -0000 1.5 *************** *** 1,78 **** using System; using System.Collections; using NHibernate.Cache; using NHibernate.Util; ! namespace NHibernate.Mapping { ! ! public class Subclass : PersistentClass { ! private PersistentClass superclass; private Value key; ! public Subclass(PersistentClass superclass) { this.superclass = superclass; } ! public override ICacheConcurrencyStrategy Cache { get { return Superclass.Cache; } set { Superclass.Cache = value; } } ! public override RootClass RootClazz { get { return Superclass.RootClazz; } } ! public override PersistentClass Superclass { get { return superclass; } set { this.superclass = superclass; } } ! public override Property IdentifierProperty { get { return Superclass.IdentifierProperty; } set { Superclass.IdentifierProperty = value; } } ! public override Value Identifier { get { return Superclass.Identifier; } set { Superclass.Identifier = value; } } ! public override bool HasIdentifierProperty { get { return Superclass.HasIdentifierProperty; } } ! public override Value Discriminator { get { return Superclass.Discriminator; } set { Superclass.Discriminator = value; } } ! public override bool IsMutable { get { return Superclass.IsMutable; } set { Superclass.IsMutable = value; } } ! public override bool IsInherited { get { return true; } } ! /// <summary> ! /// The subclass is always a polymorphic version of its superclass ! /// TODO: make sure my OO jargon is correct here. ! /// </summary> ! public override bool IsPolymorphic { get { return true; } - //set { throw new InvalidOperationException(); } } ! public override void AddProperty(Property p) { base.AddProperty(p); Superclass.AddSubclassProperty(p); } ! public override Table Table { ! get { ! return base.Table; ! } ! set { base.Table = value; Superclass.AddSubclassTable(value); } } ! public override ICollection PropertyClosureCollection { ! get { ArrayList retVal = new ArrayList(); retVal.AddRange( PropertyCollection ); --- 1,96 ---- using System; using System.Collections; + using NHibernate.Cache; using NHibernate.Util; ! namespace NHibernate.Mapping ! { ! public class Subclass : PersistentClass ! { private PersistentClass superclass; private Value key; ! public Subclass(PersistentClass superclass) ! { this.superclass = superclass; } ! public override ICacheConcurrencyStrategy Cache ! { get { return Superclass.Cache; } set { Superclass.Cache = value; } } ! public override RootClass RootClazz ! { get { return Superclass.RootClazz; } } ! public override PersistentClass Superclass ! { get { return superclass; } set { this.superclass = superclass; } } ! public override Property IdentifierProperty ! { get { return Superclass.IdentifierProperty; } set { Superclass.IdentifierProperty = value; } } ! ! public override Value Identifier ! { get { return Superclass.Identifier; } set { Superclass.Identifier = value; } } ! ! public override bool HasIdentifierProperty ! { get { return Superclass.HasIdentifierProperty; } } ! ! public override Value Discriminator ! { get { return Superclass.Discriminator; } set { Superclass.Discriminator = value; } } ! ! public override bool IsMutable ! { get { return Superclass.IsMutable; } set { Superclass.IsMutable = value; } } ! ! public override bool IsInherited ! { get { return true; } } ! public override bool IsPolymorphic ! { get { return true; } } ! ! public override void AddProperty(Property p) ! { base.AddProperty(p); Superclass.AddSubclassProperty(p); } ! ! public override Table Table ! { ! get { return base.Table; } ! set ! { base.Table = value; Superclass.AddSubclassTable(value); } } ! ! public override ICollection PropertyClosureCollection ! { ! get ! { ArrayList retVal = new ArrayList(); retVal.AddRange( PropertyCollection ); *************** *** 81,86 **** } } ! public override ICollection TableClosureCollection { ! get { ArrayList retVal = new ArrayList(); retVal.AddRange( Superclass.TableClosureCollection ); --- 99,107 ---- } } ! ! public override ICollection TableClosureCollection ! { ! get ! { ArrayList retVal = new ArrayList(); retVal.AddRange( Superclass.TableClosureCollection ); *************** *** 89,123 **** } } ! public override void AddSubclassProperty(Property p) { base.AddSubclassProperty(p); Superclass.AddSubclassProperty(p); } ! public override void AddSubclassTable(Table table) { base.AddSubclassTable(table); Superclass.AddSubclassTable(table); } ! public override bool IsVersioned { get { return Superclass.IsVersioned; } } ! public override Property Version { get { return Superclass.Version; } set { Superclass.Version = value; } } ! public override bool HasEmbeddedIdentifier { get { return Superclass.HasEmbeddedIdentifier; } set { Superclass.HasEmbeddedIdentifier = value; } } ! public override System.Type Persister { get { return Superclass.Persister; } set { Superclass.Persister = value; } } ! public override Table RootTable { get { return Superclass.RootTable; } } ! public override Value Key { ! get { ! if (key==null) { return Identifier; ! } else { return key; } --- 110,164 ---- } } ! ! public override void AddSubclassProperty(Property p) ! { base.AddSubclassProperty(p); Superclass.AddSubclassProperty(p); } ! ! public override void AddSubclassTable(Table table) ! { base.AddSubclassTable(table); Superclass.AddSubclassTable(table); } ! ! public override bool IsVersioned ! { get { return Superclass.IsVersioned; } } ! ! public override Property Version ! { get { return Superclass.Version; } set { Superclass.Version = value; } } ! ! public override bool HasEmbeddedIdentifier ! { get { return Superclass.HasEmbeddedIdentifier; } set { Superclass.HasEmbeddedIdentifier = value; } } ! ! public override System.Type Persister ! { get { return Superclass.Persister; } set { Superclass.Persister = value; } } ! ! public override Table RootTable ! { get { return Superclass.RootTable; } } ! ! public override Value Key ! { ! get ! { ! if (key==null) ! { return Identifier; ! } ! else ! { return key; } *************** *** 125,133 **** set { key = value; } } ! public override bool IsExplicitPolymorphism { get { return Superclass.IsExplicitPolymorphism; } set { Superclass.IsExplicitPolymorphism = value; } } } } --- 166,183 ---- set { key = value; } } ! ! public override bool IsExplicitPolymorphism ! { get { return Superclass.IsExplicitPolymorphism; } set { Superclass.IsExplicitPolymorphism = value; } } + public override string Where + { + get { return Superclass.Where; } + set { throw new NotImplementedException("The Where string can not be set on the Subclass - use the RootClass instead."); } + } + + } } Index: PersistentClass.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/PersistentClass.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PersistentClass.cs 13 Apr 2004 02:06:54 -0000 1.9 --- PersistentClass.cs 13 Apr 2004 17:58:01 -0000 1.10 *************** *** 73,82 **** 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); } --- 73,84 ---- 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); } *************** *** 122,138 **** } ! public abstract bool IsMutable { get; set;} // set?? public abstract bool HasIdentifierProperty { get; } ! public abstract Property IdentifierProperty { get; set; } //set?? ! public abstract Value Identifier { get; set; } //set?? ! public abstract Property Version { get; set; } //set?? ! public abstract Value Discriminator { get; set; } //set?? public abstract bool IsInherited { get; } // see the comment in RootClass about why the polymorphic setter is commented out ! public abstract bool IsPolymorphic { get; } //set; } public abstract bool IsVersioned { get;} ! public abstract ICacheConcurrencyStrategy Cache { get; set;} //set?? ! public abstract PersistentClass Superclass { get; set; } //set?? ! public abstract bool IsExplicitPolymorphism { get; set;}//set?? public abstract ICollection PropertyClosureCollection { get; } --- 124,140 ---- } ! 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; } *************** *** 183,195 **** public virtual bool IsForceDiscriminator { get { return false; } ! set { //??? ! } } ! public abstract bool HasEmbeddedIdentifier { get; set;} //set?? ! public abstract System.Type Persister { get; set;} //set?? public abstract Table RootTable { get; } public abstract RootClass RootClazz { get; } ! public abstract Value Key { get; set; } //set?? public virtual void CreatePrimaryKey() --- 185,196 ---- 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() *************** *** 197,201 **** PrimaryKey pk = new PrimaryKey(); pk.Table = table; ! pk.Name = PKAlias.ToAliasString(table.Name); // StringHelper.Suffix( table.Name, "PK" ); table.PrimaryKey = pk; --- 198,202 ---- PrimaryKey pk = new PrimaryKey(); pk.Table = table; ! pk.Name = PKAlias.ToAliasString(table.Name); table.PrimaryKey = pk; *************** *** 206,216 **** } ! //TODO: H2.0.3 - make abstract... ! public virtual string Where ! { ! get { return ""; } ! } ! ! } } --- 207,212 ---- } ! public abstract string Where { get; set; } ! } } |