From: Kevin W. <kev...@us...> - 2004-12-31 21:28:07
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32146 Modified Files: Property.cs RootClass.cs Set.cs Subclass.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: Property.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Property.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Property.cs 10 Sep 2004 21:23:15 -0000 1.9 --- Property.cs 31 Dec 2004 21:27:54 -0000 1.10 *************** *** 1,12 **** - using System; using System.Collections; - using NHibernate.Engine; - using NHibernate.Type; using NHibernate.Property; ! namespace NHibernate.Mapping { ! public class Property { private string name; --- 1,11 ---- using System.Collections; using NHibernate.Engine; using NHibernate.Property; + using NHibernate.Type; ! namespace NHibernate.Mapping { ! /// <summary></summary> ! public class Property { private string name; *************** *** 17,26 **** private string propertyAccessorName; ! public Property(Value propertyValue) { this.propertyValue = propertyValue; } ! public IType Type { get { return propertyValue.Type; } --- 16,30 ---- private string propertyAccessorName; ! /// <summary> ! /// ! /// </summary> ! /// <param name="propertyValue"></param> ! public Property( Value propertyValue ) { this.propertyValue = propertyValue; } ! /// <summary></summary> ! public IType Type { get { return propertyValue.Type; } *************** *** 30,34 **** /// Gets the number of columns this property uses in the db. /// </summary> ! public int ColumnSpan { get { return propertyValue.ColumnSpan; } --- 34,38 ---- /// Gets the number of columns this property uses in the db. /// </summary> ! public int ColumnSpan { get { return propertyValue.ColumnSpan; } *************** *** 38,42 **** /// Gets an <see cref="ICollection"/> of <see cref="Column"/>s. /// </summary> ! public ICollection ColumnCollection { get { return propertyValue.ColumnCollection; } --- 42,46 ---- /// Gets an <see cref="ICollection"/> of <see cref="Column"/>s. /// </summary> ! public ICollection ColumnCollection { get { return propertyValue.ColumnCollection; } *************** *** 46,50 **** /// Gets or Sets the name of the Property in the class. /// </summary> ! public string Name { get { return name; } --- 50,54 ---- /// Gets or Sets the name of the Property in the class. /// </summary> ! public string Name { get { return name; } *************** *** 52,67 **** } ! public bool IsUpdateable { ! get { return updateable && !IsFormula ; } set { updateable = value; } } ! public bool IsComposite { get { return propertyValue is Component; } } ! public Value Value { get { return propertyValue; } --- 56,74 ---- } ! /// <summary></summary> ! public bool IsUpdateable { ! get { return updateable && !IsFormula; } set { updateable = value; } } ! /// <summary></summary> ! public bool IsComposite { get { return propertyValue is Component; } } ! /// <summary></summary> ! public Value Value { get { return propertyValue; } *************** *** 69,112 **** } ! public Cascades.CascadeStyle CascadeStyle { ! get { IType type = propertyValue.Type; ! if (type.IsComponentType && !type.IsObjectType) { ! IAbstractComponentType actype = (IAbstractComponentType) propertyValue.Type; int length = actype.Subtypes.Length; ! for (int i=0; i<length; i++) { ! if ( actype.Cascade(i)!= Cascades.CascadeStyle.StyleNone ) return Cascades.CascadeStyle.StyleAll; } return Cascades.CascadeStyle.StyleNone; ! } ! else { ! if (cascade.Equals("all")) { return Cascades.CascadeStyle.StyleAll; ! } ! else if (cascade.Equals("all-delete-orphan") ) { return Cascades.CascadeStyle.StyleAllGC; } ! else if (cascade.Equals("none")) { return Cascades.CascadeStyle.StyleNone; ! } ! else if (cascade.Equals("save-update")) { return Cascades.CascadeStyle.StyleSaveUpdate; ! } ! else if (cascade.Equals("delete")) { return Cascades.CascadeStyle.StyleOnlyDelete; ! } ! else { ! throw new MappingException("Unspported cascade style: " + cascade); } } --- 76,124 ---- } ! /// <summary></summary> ! public Cascades.CascadeStyle CascadeStyle { ! get ! { IType type = propertyValue.Type; ! if( type.IsComponentType && !type.IsObjectType ) { ! IAbstractComponentType actype = ( IAbstractComponentType ) propertyValue.Type; int length = actype.Subtypes.Length; ! for( int i = 0; i < length; i++ ) { ! if( actype.Cascade( i ) != Cascades.CascadeStyle.StyleNone ) ! { ! return Cascades.CascadeStyle.StyleAll; ! } } return Cascades.CascadeStyle.StyleNone; ! } ! else { ! if( cascade.Equals( "all" ) ) { return Cascades.CascadeStyle.StyleAll; ! } ! else if( cascade.Equals( "all-delete-orphan" ) ) { return Cascades.CascadeStyle.StyleAllGC; } ! else if( cascade.Equals( "none" ) ) { return Cascades.CascadeStyle.StyleNone; ! } ! else if( cascade.Equals( "save-update" ) ) { return Cascades.CascadeStyle.StyleSaveUpdate; ! } ! else if( cascade.Equals( "delete" ) ) { return Cascades.CascadeStyle.StyleOnlyDelete; ! } ! else { ! throw new MappingException( "Unspported cascade style: " + cascade ); } } *************** *** 114,118 **** } ! public string Cascade { get { return cascade; } --- 126,131 ---- } ! /// <summary></summary> ! public string Cascade { get { return cascade; } *************** *** 120,139 **** } ! public bool IsInsertable { get { return insertable && !IsFormula; } set { insertable = value; } } ! public Formula Formula { get { return propertyValue.Formula; } } ! public bool IsFormula { ! get { return Formula!=null; } } ! public string PropertyAccessorName { get { return propertyAccessorName; } --- 133,157 ---- } ! /// <summary></summary> ! public bool IsInsertable ! { get { return insertable && !IsFormula; } set { insertable = value; } } ! /// <summary></summary> ! public Formula Formula { get { return propertyValue.Formula; } } ! /// <summary></summary> ! public bool IsFormula { ! get { return Formula != null; } } ! /// <summary></summary> ! public string PropertyAccessorName { get { return propertyAccessorName; } *************** *** 141,162 **** } ! public IGetter GetGetter(System.Type clazz) { ! return PropertyAccessor.GetGetter(clazz, name); } ! public ISetter GetSetter(System.Type clazz) { ! return PropertyAccessor.GetSetter(clazz, name); } ! protected IPropertyAccessor PropertyAccessor { get { return PropertyAccessorFactory.GetPropertyAccessor( PropertyAccessorName ); } } ! public bool IsBasicPropertyAccessor { ! get { return propertyAccessorName==null || propertyAccessorName.Equals("property"); } } } --- 159,192 ---- } ! /// <summary> ! /// ! /// </summary> ! /// <param name="clazz"></param> ! /// <returns></returns> ! public IGetter GetGetter( System.Type clazz ) { ! return PropertyAccessor.GetGetter( clazz, name ); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="clazz"></param> ! /// <returns></returns> ! public ISetter GetSetter( System.Type clazz ) { ! return PropertyAccessor.GetSetter( clazz, name ); } ! /// <summary></summary> ! protected IPropertyAccessor PropertyAccessor { get { return PropertyAccessorFactory.GetPropertyAccessor( PropertyAccessorName ); } } ! /// <summary></summary> ! public bool IsBasicPropertyAccessor { ! get { return propertyAccessorName == null || propertyAccessorName.Equals( "property" ); } } } Index: RootClass.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/RootClass.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** RootClass.cs 10 Sep 2004 21:23:15 -0000 1.10 --- RootClass.cs 31 Dec 2004 21:27:54 -0000 1.11 *************** *** 1,8 **** using System; using System.Collections; using NHibernate.Cache; ! namespace NHibernate.Mapping ! { /// <summary> /// Declaration of a System.Type by using the <c><class></c> element. --- 1,10 ---- using System; using System.Collections; + using log4net; using NHibernate.Cache; + using NHibernate.Persister; ! namespace NHibernate.Mapping ! { /// <summary> /// Declaration of a System.Type by using the <c><class></c> element. *************** *** 79,91 **** /// <item> /// <term>persister</term> ! /// <description>(optional) Specifies a custom <see cref="Persister.IClassPersister"/>.</description> /// </item> /// </list> /// </remarks> ! 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"; --- 81,95 ---- /// <item> /// <term>persister</term> ! /// <description>(optional) Specifies a custom <see cref="IClassPersister"/>.</description> /// </item> /// </list> /// </remarks> ! public class RootClass : PersistentClass { ! private static readonly ILog log = LogManager.GetLogger( typeof( RootClass ) ); ! ! /// <summary></summary> public const string DefaultIdentifierColumnName = "id"; + /// <summary></summary> public const string DefaultDiscriminatorColumnName = "class"; *************** *** 103,115 **** private string where; public bool Polymorphic { ! set ! { ! polymorphic = value; ! } } ! public override Property IdentifierProperty { get { return identifierProperty; } --- 107,118 ---- private string where; + /// <summary></summary> public bool Polymorphic { ! set { polymorphic = value; } } ! /// <summary></summary> ! public override Property IdentifierProperty { get { return identifierProperty; } *************** *** 117,121 **** } ! public override Value Identifier { get { return identifier; } --- 120,125 ---- } ! /// <summary></summary> ! public override Value Identifier { get { return identifier; } *************** *** 123,132 **** } ! public override bool HasIdentifierProperty { get { return identifierProperty != null; } } ! public override Value Discriminator { get { return discriminator; } --- 127,138 ---- } ! /// <summary></summary> ! public override bool HasIdentifierProperty { get { return identifierProperty != null; } } ! /// <summary></summary> ! public override Value Discriminator { get { return discriminator; } *************** *** 134,142 **** } ! public override bool IsInherited { get { return false; } } ! /// <summary> /// Indicates if the object has subclasses --- 140,149 ---- } ! /// <summary></summary> ! public override bool IsInherited { get { return false; } } ! /// <summary> /// Indicates if the object has subclasses *************** *** 146,164 **** /// 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; } } ! /// <summary> /// Returns all of the Tables the Root class covers. --- 153,173 ---- /// through any other method - so no setter is declared for this property. /// </remarks> ! public override bool IsPolymorphic { get { return polymorphic; } } ! /// <summary></summary> ! public override RootClass RootClazz { get { return this; } } ! /// <summary></summary> ! public override ICollection PropertyClosureCollection { get { return PropertyCollection; } } ! /// <summary> /// Returns all of the Tables the Root class covers. *************** *** 167,174 **** /// 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 ); --- 176,183 ---- /// 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 ); *************** *** 177,187 **** } ! public override void AddSubclass(Subclass subclass) { ! base.AddSubclass(subclass); polymorphic = true; } ! public override bool IsExplicitPolymorphism { get { return explicitPolymorphism; } --- 186,201 ---- } ! /// <summary> ! /// ! /// </summary> ! /// <param name="subclass"></param> ! public override void AddSubclass( Subclass subclass ) { ! base.AddSubclass( subclass ); polymorphic = true; } ! /// <summary></summary> ! public override bool IsExplicitPolymorphism { get { return explicitPolymorphism; } *************** *** 195,199 **** /// <remarks> /// <para> ! /// The &;tlversion> element is optional and indicates that the table contains versioned data. /// This is particularly useful if you plan to use long transactions (see below). /// </para> --- 209,213 ---- /// <remarks> /// <para> ! /// The <version> element is optional and indicates that the table contains versioned data. /// This is particularly useful if you plan to use long transactions (see below). /// </para> *************** *** 225,229 **** /// </para> /// </remarks> ! public override Property Version { get { return version; } --- 239,243 ---- /// </para> /// </remarks> ! public override Property Version { get { return version; } *************** *** 236,245 **** /// </summary> /// <value><c>true</c> if there is a version property.</value> ! public override bool IsVersioned { get { return version != null; } } ! public override ICacheConcurrencyStrategy Cache { get { return cache; } --- 250,260 ---- /// </summary> /// <value><c>true</c> if there is a version property.</value> ! public override bool IsVersioned { get { return version != null; } } ! /// <summary></summary> ! public override ICacheConcurrencyStrategy Cache { get { return cache; } *************** *** 247,251 **** } ! public override bool IsMutable { get { return mutable; } --- 262,267 ---- } ! /// <summary></summary> ! public override bool IsMutable { get { return mutable; } *************** *** 253,257 **** } ! public override bool HasEmbeddedIdentifier { get { return embeddedIdentifier; } --- 269,274 ---- } ! /// <summary></summary> ! public override bool HasEmbeddedIdentifier { get { return embeddedIdentifier; } *************** *** 259,263 **** } ! public override System.Type Persister { get { return persister; } --- 276,281 ---- } ! /// <summary></summary> ! public override System.Type Persister { get { return persister; } *************** *** 265,280 **** } ! 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; } --- 283,301 ---- } ! /// <summary></summary> ! public override Table RootTable { get { return Table; } } ! /// <summary></summary> ! public override PersistentClass Superclass { get { return null; } ! set { throw new InvalidOperationException( "Can not set the Superclass on a RootClass." ); } } ! /// <summary></summary> ! public override Value Key { get { return Identifier; } *************** *** 282,286 **** } ! public override bool IsForceDiscriminator { get { return forceDiscriminator; } --- 303,308 ---- } ! /// <summary></summary> ! public override bool IsForceDiscriminator { get { return forceDiscriminator; } *************** *** 288,297 **** } public override string Where { ! get { return where; } set { where = value; } } } ! } --- 310,320 ---- } + /// <summary></summary> public override string Where { ! get { return where; } set { where = value; } } } ! } \ No newline at end of file Index: Subclass.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Subclass.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Subclass.cs 13 Apr 2004 17:58:11 -0000 1.5 --- Subclass.cs 31 Dec 2004 21:27:54 -0000 1.6 *************** *** 1,21 **** 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; } --- 1,25 ---- using System; using System.Collections; using NHibernate.Cache; ! namespace NHibernate.Mapping { ! /// <summary></summary> ! public class Subclass : PersistentClass { private PersistentClass superclass; private Value key; ! /// <summary> ! /// ! /// </summary> ! /// <param name="superclass"></param> ! public Subclass( PersistentClass superclass ) { this.superclass = superclass; } ! /// <summary></summary> ! public override ICacheConcurrencyStrategy Cache { get { return Superclass.Cache; } *************** *** 23,32 **** } ! public override RootClass RootClazz { get { return Superclass.RootClazz; } } ! public override PersistentClass Superclass { get { return superclass; } --- 27,38 ---- } ! /// <summary></summary> ! public override RootClass RootClazz { get { return Superclass.RootClazz; } } ! /// <summary></summary> ! public override PersistentClass Superclass { get { return superclass; } *************** *** 34,38 **** } ! public override Property IdentifierProperty { get { return Superclass.IdentifierProperty; } --- 40,45 ---- } ! /// <summary></summary> ! public override Property IdentifierProperty { get { return Superclass.IdentifierProperty; } *************** *** 40,44 **** } ! public override Value Identifier { get { return Superclass.Identifier; } --- 47,52 ---- } ! /// <summary></summary> ! public override Value Identifier { get { return Superclass.Identifier; } *************** *** 46,96 **** } ! 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 ); --- 54,115 ---- } ! /// <summary></summary> ! public override bool HasIdentifierProperty { get { return Superclass.HasIdentifierProperty; } } ! ! /// <summary></summary> ! public override Value Discriminator { get { return Superclass.Discriminator; } set { Superclass.Discriminator = value; } } ! ! /// <summary></summary> ! public override bool IsMutable { get { return Superclass.IsMutable; } set { Superclass.IsMutable = value; } } ! ! /// <summary></summary> ! public override bool IsInherited { get { return true; } } ! ! /// <summary></summary> ! public override bool IsPolymorphic { get { return true; } } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="p"></param> ! public override void AddProperty( Property p ) { ! base.AddProperty( p ); ! Superclass.AddSubclassProperty( p ); } ! ! /// <summary></summary> ! public override Table Table { get { return base.Table; } ! set { base.Table = value; ! Superclass.AddSubclassTable( value ); } } ! ! /// <summary></summary> ! public override ICollection PropertyClosureCollection { ! get ! { ArrayList retVal = new ArrayList(); retVal.AddRange( PropertyCollection ); *************** *** 99,106 **** } } ! ! public override ICollection TableClosureCollection { ! get { ArrayList retVal = new ArrayList(); --- 118,126 ---- } } ! ! /// <summary></summary> ! public override ICollection TableClosureCollection { ! get { ArrayList retVal = new ArrayList(); *************** *** 110,163 **** } } ! ! 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; --- 130,197 ---- } } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="p"></param> ! public override void AddSubclassProperty( Property p ) { ! base.AddSubclassProperty( p ); ! Superclass.AddSubclassProperty( p ); } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="table"></param> ! public override void AddSubclassTable( Table table ) { ! base.AddSubclassTable( table ); ! Superclass.AddSubclassTable( table ); } ! ! /// <summary></summary> ! public override bool IsVersioned { get { return Superclass.IsVersioned; } } ! ! /// <summary></summary> ! public override Property Version { get { return Superclass.Version; } set { Superclass.Version = value; } } ! ! /// <summary></summary> ! public override bool HasEmbeddedIdentifier { get { return Superclass.HasEmbeddedIdentifier; } set { Superclass.HasEmbeddedIdentifier = value; } } ! ! /// <summary></summary> ! public override System.Type Persister { get { return Superclass.Persister; } set { Superclass.Persister = value; } } ! ! /// <summary></summary> ! public override Table RootTable { get { return Superclass.RootTable; } } ! ! /// <summary></summary> ! public override Value Key { ! get { ! if( key == null ) { return Identifier; ! } ! else { return key; *************** *** 166,171 **** set { key = value; } } ! ! public override bool IsExplicitPolymorphism { get { return Superclass.IsExplicitPolymorphism; } --- 200,206 ---- set { key = value; } } ! ! /// <summary></summary> ! public override bool IsExplicitPolymorphism { get { return Superclass.IsExplicitPolymorphism; } *************** *** 173,183 **** } 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."); } } } ! } --- 208,219 ---- } + /// <summary></summary> 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." ); } } } ! } \ No newline at end of file Index: Set.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Set.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Set.cs 27 Apr 2004 15:49:22 -0000 1.5 --- Set.cs 31 Dec 2004 21:27:54 -0000 1.6 *************** *** 1,8 **** ! using System; ! ! using NCollection = NHibernate.Collection; using NHibernate.Type; ! namespace NHibernate.Mapping { /// <summary> --- 1,8 ---- ! using NHibernate.Collection; using NHibernate.Type; + using Collection_Set = NHibernate.Collection.Set; + using NCollection = NHibernate.Collection; ! namespace NHibernate.Mapping { /// <summary> *************** *** 11,17 **** /// element columns). /// </summary> ! public class Set : Collection { ! public Set(PersistentClass owner) : base(owner) { } --- 11,22 ---- /// element columns). /// </summary> ! public class Set : Collection { ! /// <summary> ! /// ! /// </summary> ! /// <param name="owner"></param> ! public Set( PersistentClass owner ) : base( owner ) ! { } *************** *** 19,23 **** /// <see cref="Collection.IsSet"/> /// </summary> ! public override bool IsSet { get { return true; } --- 24,28 ---- /// <see cref="Collection.IsSet"/> /// </summary> ! public override bool IsSet { get { return true; } *************** *** 27,37 **** /// <see cref="Collection.Type"/> /// </summary> ! public override PersistentCollectionType Type { ! get { return IsSorted ? ! TypeFactory.SortedSet(Role, Comparer) : ! TypeFactory.Set(Role); } } --- 32,42 ---- /// <see cref="Collection.Type"/> /// </summary> ! public override PersistentCollectionType Type { ! get { return IsSorted ? ! TypeFactory.SortedSet( Role, Comparer ) : ! TypeFactory.Set( Role ); } } *************** *** 40,73 **** /// <see cref="Collection.WrapperClass"/> /// </summary> ! public override System.Type WrapperClass { ! get { ! return IsSorted ? ! typeof(NCollection.SortedSet) : ! typeof(NCollection.Set); } } ! ! public void CreatePrimaryKey() { PrimaryKey pk = new PrimaryKey(); ! foreach(Column col in Key.ColumnCollection) { ! pk.AddColumn(col); } bool nullable = false; ! foreach(Column col in Element.ColumnCollection) { ! if(col.IsNullable) nullable = true; ! pk.AddColumn(col); } // some databases (Postgres) will tolerate nullable // column in a primary key - others (DB2) won't ! if(!nullable) Table.PrimaryKey = pk; } } ! } --- 45,84 ---- /// <see cref="Collection.WrapperClass"/> /// </summary> ! public override System.Type WrapperClass { ! get { ! return IsSorted ? ! typeof( SortedSet ) : ! typeof( Collection_Set ); } } ! /// <summary></summary> ! public void CreatePrimaryKey() { PrimaryKey pk = new PrimaryKey(); ! foreach( Column col in Key.ColumnCollection ) { ! pk.AddColumn( col ); } bool nullable = false; ! foreach( Column col in Element.ColumnCollection ) { ! if( col.IsNullable ) ! { ! nullable = true; ! } ! pk.AddColumn( col ); } // some databases (Postgres) will tolerate nullable // column in a primary key - others (DB2) won't ! if( !nullable ) ! { ! Table.PrimaryKey = pk; ! } } } ! } \ No newline at end of file |