NHibernate supports collections implemented by System.Collections.SortedList and Iesi.Collections.SortedSet. You must specify the mapping in the mapping file:
<set name="Aliases" table="person_aliases" sort="natural">
<key column="person"/>
<element column="name" type="String"/>
</set>
<map name="Holidays" sort="My.Custom.HolidayComparer, MyAssembly" lazy="true">
<key column="year_id"/>
<index column="hol_name" type="String"/>
<element column="hol_date" type="Date"/>
</map>
Valid values ββfor the sort attribute are unsorted, natural, and the name of the class that implements System.Collections.IComparer.
, , order-by , . SQL, .
order-by NHibernate ListDictionary ListSet , . , , .
<set name="Aliases" table="person_aliases" order-by="name asc">
<key column="person"/>
<element column="name" type="String"/>
</set>
<map name="Holidays" order-by="hol_date, hol_name" lazy="true">
<key column="year_id"/>
<index column="hol_name" type="String"/>
<element column="hol_date type="Date"/>
</map>
, order-by - SQL, HQL-!
().
sortedUsers = s.Filter( group.Users, "order by this.Name" );
:
NHibernate