Hmm. NHibernate docs say to use IComparer, and I can't reproduce the issue you're having.
On Wed, Aug 19, 2009 at 8:39 AM, James Gregory <[email protected]>wrote: > Ah, that probably explains why somebody else just raised a bug where it was > complaining that the comparer needs to implement IComparer<T> not > IComparer... We're obviously telling them to use IComparer! > Thanks for pointing this out, I'll get it fixed. > > 2009/8/19 Jeffrey Zhao <[email protected]> > > >> One of the overload of AsSet method in ToManyBase class accepts an generic >> parameter like this: >> >> public T AsSet<TComparer>() where TComparer : >> System.Collections.IComparer; >> >> >> TComparer has to be System.Collections.IComparer type but NHibernate needs >> an System.Collections.Generics.IComparer<T> type. So now I have to >> specified >> an comparer like this: >> >> public class CategoryComparer : IComparer, IComparer<Category> >> { >> #region IComparer Members >> >> public int Compare(object x, object y) >> { >> return this.Compare((Category)x, (Category)y); >> } >> >> #endregion >> >> #region IComparer<Category> Members >> >> public int Compare(Category x, Category y) >> { >> return x.SortOrder - y.SortOrder; >> } >> >> #endregion >> } >> >> >> I didn't check the AsMap method but maybe it would have the same problem. >> >> >> Jeffrey Zhao >> Blog: http://www.cnblogs.com/JeffreyZhao >> Twitter: http://twitter.com/jeffz_cn >> >> >> >> >> > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---
