From: Michael D. <mik...@us...> - 2004-04-27 15:49:31
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28813/NHibernate/Type Modified Files: SortedMapType.cs SortedSetType.cs TypeFactory.cs Log Message: Added support for the attributes "order-by" and "sort" attribute on <set> and <map> elements. Index: SortedMapType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/SortedMapType.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SortedMapType.cs 20 Feb 2003 21:42:15 -0000 1.1 --- SortedMapType.cs 27 Apr 2004 15:49:22 -0000 1.2 *************** *** 1,16 **** using System; namespace NHibernate.Type { /// <summary> ! /// Summary description for SortedMapType. /// </summary> ! public class SortedMapType { ! public SortedMapType() { ! // ! // TODO: Add constructor logic here ! // } } --- 1,40 ---- using System; + using System.Collections; + + using NHibernate.Collection; + using NHibernate.Engine; namespace NHibernate.Type { /// <summary> ! /// Extends the MapType to provide Sorting. /// </summary> ! public class SortedMapType : MapType { ! private IComparer comparer; ! ! public SortedMapType(string role, IComparer comparer) : base(role) { ! this.comparer = comparer; ! } ! ! public override PersistentCollection Instantiate(ISessionImplementor session, CollectionPersister persister) ! { ! SortedMap sortedMap = new SortedMap(session, comparer); ! return sortedMap; ! } ! ! //public System.Type ReturnedClass {get;} -> was overridden in H2.0.3 ! // because they have different Interfaces for Sorted/UnSorted - since .NET ! // doesn't have that I don't need to override it. ! ! public override PersistentCollection Wrap(ISessionImplementor session, object collection) ! { ! return new SortedMap(session, (IDictionary)collection, comparer); ! } ! ! public override PersistentCollection AssembleCachedCollection(ISessionImplementor session, CollectionPersister persister, object disassembled, object owner) ! { ! return new SortedMap(session, persister, comparer, disassembled, owner); } } Index: TypeFactory.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/TypeFactory.cs,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** TypeFactory.cs 21 Apr 2004 14:33:07 -0000 1.27 --- TypeFactory.cs 27 Apr 2004 15:49:22 -0000 1.28 *************** *** 1068,1076 **** return new SetType(role); } ! /* public static PersistentCollectionType SortedMap(string role, IComparer comparer) { return new SortedMapType(role, comparer); ! }*/ public static PersistentCollectionType SortedSet(string role, IComparer comparer) --- 1068,1076 ---- return new SetType(role); } ! public static PersistentCollectionType SortedMap(string role, IComparer comparer) { return new SortedMapType(role, comparer); ! } public static PersistentCollectionType SortedSet(string role, IComparer comparer) Index: SortedSetType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/SortedSetType.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SortedSetType.cs 8 Apr 2004 21:11:33 -0000 1.3 --- SortedSetType.cs 27 Apr 2004 15:49:22 -0000 1.4 *************** *** 5,23 **** using NHibernate.Engine; ! namespace NHibernate.Type{ /// <summary> /// Extends the SetType to provide Sorting. /// </summary> ! public class SortedSetType : SetType { ! private IComparer comparer; ! public SortedSetType(string role, IComparer comparer) : base(role){ this.comparer = comparer; } ! public override PersistentCollection Instantiate(ISessionImplementor session, CollectionPersister persister) { SortedSet sortedSet = new SortedSet(session, comparer); - //sortedSet.Comparer = comparer; return sortedSet; } --- 5,25 ---- using NHibernate.Engine; ! namespace NHibernate.Type ! { /// <summary> /// Extends the SetType to provide Sorting. /// </summary> ! public class SortedSetType : SetType ! { private IComparer comparer; ! public SortedSetType(string role, IComparer comparer) : base(role) ! { this.comparer = comparer; } ! public override PersistentCollection Instantiate(ISessionImplementor session, CollectionPersister persister) ! { SortedSet sortedSet = new SortedSet(session, comparer); return sortedSet; } *************** *** 27,40 **** // doesn't have that I don't need to override it. ! public override PersistentCollection Wrap(ISessionImplementor session, object collection) { return new SortedSet(session, (IDictionary)collection, comparer); } ! public override PersistentCollection AssembleCachedCollection(ISessionImplementor session, CollectionPersister persister, object disassembled, object owner) { return new SortedSet(session, persister, comparer, disassembled, owner); } - - } --- 29,42 ---- // doesn't have that I don't need to override it. ! public override PersistentCollection Wrap(ISessionImplementor session, object collection) ! { return new SortedSet(session, (IDictionary)collection, comparer); } ! public override PersistentCollection AssembleCachedCollection(ISessionImplementor session, CollectionPersister persister, object disassembled, object owner) ! { return new SortedSet(session, persister, comparer, disassembled, owner); } } |