|
From: Michael D. <mik...@us...> - 2004-04-14 03:06:29
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1907/Mapping Added Files: IdentifierBag.cs IdentifierCollection.cs Log Message: Added IdentifierCollection & IdentifierBag to mapping synch with h2.0.3 --- NEW FILE: IdentifierCollection.cs --- using System; using System.Collections; namespace NHibernate.Mapping { /// <summary> /// A collection with a synthetic "identifier" column. /// </summary> public abstract class IdentifierCollection : Collection { public static readonly string DefaultIdentifierColumnName = "id"; private Value identifier; public IdentifierCollection(PersistentClass owner) : base(owner) { } public Value Identifier { get { return identifier; } set { identifier = value; } } public override bool IsIdentified { get { return true; } } public void CreatePrimaryKey() { PrimaryKey pk = new PrimaryKey(); foreach(Column col in Identifier.ColumnCollection) { pk.AddColumn(col); } Table.PrimaryKey = pk; } } } --- NEW FILE: IdentifierBag.cs --- using System; using NHCollection = NHibernate.Collection; using NHibernate.Type; namespace NHibernate.Mapping { /// <summary> /// An <c>IdentifierBag</c> has a primary key consistenting of just /// the identifier column. /// </summary> public class IdentifierBag : IdentifierCollection { public IdentifierBag(PersistentClass owner) : base(owner) { } //TODO: need to implement an IdentifierBag in PersistentColleciton. public override PersistentCollectionType Type { get { throw new NotImplementedException("need to code IdentifierBag"); //return TypeFactory.Bag(Role)); } } public override System.Type WrapperClass { get { throw new NotImplementedException("need to code IdentifierBag"); //return typeof(NHCollection.IdentifierBag) ; } } } } |