Weird i am using just as is! (with properties of type Iset<Foo> ) The source code is here: https://bitbucket.org/jfromaniello/nhibernate.setfornet4<https://bitbucket.org/jfromaniello/nhibernate.setfornet4/src/7f68cf01a076/NHibernateSetForNet4/>
<https://bitbucket.org/jfromaniello/nhibernate.setfornet4/src/7f68cf01a076/NHibernateSetForNet4/>i'll add some tests in this repository ( i have tests on another rep. i think) 2011/5/11 Neo <[email protected]> > I'm looking into José Romaniello's Net4Collections class to use the > BCL HashSet instead of the iesi HashedSet, but I'm getting an > exception when my model looks like this: > > public class Survey > { > public virtual string Name { get; set; } > public virtual ISet<Question> Questions { get; set; } > > public Survey() { > this.Questions = new HashSet<Question>(); > } > } > > Whenever I try to save a new Survey with a populated Questions > collection I get an exception saying: > {"Unable to cast object of type > > 'NHibernate.Collection.Generic.PersistentGenericSet`1[Demo.Models.Question]' > to type 'System.Collections.Generic.ISet`1[Demo.Models.Question]'."} > > But if I expose my Questions property like "ICollection<Question>" it > works fine. > > And yes, I have > > "configure.Properties[NHibernate.Cfg.Environment.CollectionTypeFactoryClass] > = typeof(Net4CollectionTypeFactory).AssemblyQualifiedName;". > > This is with the latest alpha of NHibernate 3.2. > > I have no problems sticking with ICollection<> but just wondering if > I'm missing something to get it to work. > > Cheers! > > -- > 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. > > -- 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.
