Code:
public abstract class ListBase<T> :
IList<T>,
IEnumerable<T>,
IRaiseItemChangedEvents
where T : class, INotifyPropertyChanged
{
/// <summary>
/// Hibernates IList
/// </summary>
protected IList<T> items;
...
public virtual void Sort( Comparison<T> comparer )
{
// Iteration durch die Liste
for ( int i = 0; i < items.Count - 1; i++ )
{
for ( int j = i + 1; j < items.Count; j++ )
{
if ( comparer( items[i], items[j] ) > 0 )
{
T temp = items[i];
items[i] = items[j];
items[j] = temp;
}
}
}
// raise Reset Event
RaiseListChangedEvent( new ListChangedEventArgs( ListChangedType.Reset, -1 ) );
}
...
}
and the mapping for this list in a class
Code:
<component name="PartnerItems" class="PartnerList">
<bag name="Items" table="sx.bus_partner" lazy="false" order-by="orderby asc" cascade="all-delete-orphan">
<key column="containeruid"/>
<one-to-many class="Partner"/>
</bag>
</component>
where Partnerlist is derived from ListBase<Partner>.