If the order is an integer the <list> mapping is the right way.For some special stuff you can use <map> to a field and expose something else than a IDictionary. If what you need is a sorted ISet, IDictionary by a specific entity-property, even using a custom comparer, you can use the "sort" attribute or the "sort" and "collectio-type" attributes.
2009/1/8 Jimboyoo <[email protected]> > > I'm still learning my way around NHibernate myself, but I was JUST > trying to do this yesterday! After some looking around, I was able to > do exactly what you are trying to achieve. > I'm not sure if the IList<Term> will work though, maybe it will. I > always have better luck working with ISet<>, and have my mappings use > SETS. > > You stated that "mapping this is easy", but that's the most important > thing, and that's what took me so long to figure out. But If you have > it mapped correctly to your DB then it'll behave exactly the way you'd > expect. You can treat it like this: > > Term a = new Term(1, "Term A"); > Term b = new Term(2, "Term B"); > > a.RelatedTerms.add(b); > > Happy programming! > > > On Jan 7, 11:15 am, ccollie <[email protected]> wrote: > > Hello, > > is it possible to cleanly handle a self-referential many-many ? > > Here's the scenario : > > > > public class Term > > { > > public int id {get; set} > > public String Name {get; set;} > > public IList<Term> RelatedTerms {get; set;} > > > > } > > > > Mapping this is easy enough, though i dont think id get the required > > semantics r.e. adding and removing related items. > > > > -- Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" 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/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
