I've just been informed by another thread that our AsSet method is expecting an IComparer, not IComparer<T>; so it's understandable why you've gone that route. I'll be putting in a fix for this tonight.
On Wed, Aug 19, 2009 at 8:38 AM, James Gregory <[email protected]>wrote: > I think the exception is fairly self explanatory. You need to implement the > generic IComparer<T> interface, not the un-generic IComparer. > > > On Wed, Aug 19, 2009 at 7:22 AM, James.Ying <[email protected]> wrote: > >> >> >> Entity Model: >> >> public partial class ProductCategory >> { >> public class Comparer : IComparer >> { >> #region IComparer Members >> public int Compare(object x, object y) >> { >> return ((ProductCategory)x).SortOrder - >> ((ProductCategory)y).SortOrder; >> } >> #endregion >> } >> } >> >> Mapping: >> >> HasMany<ProductCategory>(c => c.Children) >> .LazyLoad() >> .AsSet<ProductCategory.Comparer>() >> .KeyColumn("ParentID") >> .Cascade.All() >> .Inverse(); >> >> throw FluentNHibernate.Cfg.FluentConfigurationException: >> >> BaiShengTech.ECommerce.Data.Test.ProductCategoryMapTest.CheckProductCategory >> : >> FluentNHibernate.Cfg.FluentConfigurationException : An invalid or >> incomplete configuration was used while creating a SessionFactory. >> Check PotentialReasons collection, and InnerException for more detail. >> ---- System.ArgumentException : Object of type >> 'BaiShengTech.ECommerce.ProductCategory+Comparer' cannot be converted >> to type 'System.Collections.Generic.IComparer`1 >> [BaiShengTech.ECommerce.ProductCategory]'. >> >> >> >> > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
