From: NHibernate J. <mik...@us...> - 2006-12-28 05:16:26
|
[ http://jira.nhibernate.org/browse/NH-11?page=comments#action_14680 ] Jerry Haltom commented on NH-11: -------------------------------- Iesi.Collections.Generic.SortedSet appears to exist now. Perhaps this is a better solution now? > How to do Sorted Collections > ---------------------------- > > Key: NH-11 > URL: http://jira.nhibernate.org/browse/NH-11 > Project: NHibernate > Type: Task > Reporter: Mike Doerfler > Assignee: Mike Doerfler > Fix For: prealpha > > .NET has no interface for a SortedSet (it has no Set interface, but that is a seperate gripe), or a SortedDictionary. > There is a SortedList, but the definition of a <list> in NHibernate requires an Index column so it defines the order of the items in the List. > There is a ListDictionary, but that has warnings about performance being better than Dictionary for only up to 10 items. The order of a ListDictionary is based on order of Add or using the AddAt(). It does not use a Comparer to determine where to Add an element. > The options I can see us having is to: > 1 - Use an external library that provides SortedSet/SortedDictionary functionallity similar to Javas. I want to stay as close to the .NET SDK as possible since that is what we are using :) > 2 - Change the meaning of <sorted-set> and <sorted-map> to just be sorted by Add order or AddAt. That would be more consistent with the .NET SDK and that is the way I am leaning. > The Comparer provided in the mapping would be used to determine the order to Add items from the DataReader to the collection. We could store the objects in a temporary ArrayList while we read from the DataReader and instantiate the objects, then use ArrayList.Sort(IComparer) and iterate through the sorted Array List and Add them to the Set/Dictionary. > The preferred way would to be to sort them using the order-by mapping attribute because the db would handle the sorting and give us the items in order. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |