From: Michael D. <mik...@us...> - 2004-04-09 12:51:16
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10585/Type Modified Files: BagType.cs TypeFactory.cs Log Message: Added support for Bag collections. Index: BagType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/BagType.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BagType.cs 20 Feb 2003 21:42:13 -0000 1.1 --- BagType.cs 9 Apr 2004 12:37:56 -0000 1.2 *************** *** 1,17 **** using System; namespace NHibernate.Type { /// <summary> ! /// Summary description for BagType. /// </summary> ! public class BagType { ! public BagType() { - // - // TODO: Add constructor logic here - // } } ! } --- 1,40 ---- using System; + using System.Collections; + + using NHibernate.Collection; + using NHibernate.Engine; namespace NHibernate.Type { /// <summary> ! /// /// </summary> ! public class BagType : PersistentCollectionType { ! public BagType(string role) : base(role) { } + + public override PersistentCollection Instantiate(ISessionImplementor session, CollectionPersister persister) + { + return new Bag(session); + } + + public override System.Type ReturnedClass + { + get { return typeof(IList); } + } + + public override PersistentCollection Wrap(ISessionImplementor session, object collection) + { + return new Bag(session, (ICollection)collection); + } + + + public override PersistentCollection AssembleCachedCollection(ISessionImplementor session, CollectionPersister persister, object disassembled, object owner) + { + return new Bag(session, persister, disassembled, owner); + } + } ! } \ No newline at end of file Index: TypeFactory.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/TypeFactory.cs,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** TypeFactory.cs 8 Apr 2004 15:55:46 -0000 1.23 --- TypeFactory.cs 9 Apr 2004 12:37:56 -0000 1.24 *************** *** 1013,1020 **** } ! /*public static PersistentCollectionType Bag(string role) ! * { return new BagType(role); ! }*/ public static PersistentCollectionType Map(string role) --- 1013,1020 ---- } ! public static PersistentCollectionType Bag(string role) ! { return new BagType(role); ! } public static PersistentCollectionType Map(string role) |