José, Yes, it's a bad namming but it's just a sample that I try to test the new version of NHibernate (I used the 2.1.x after).
I really try many solutions (from this forum, google and so on) but the collection simple doesn't fill from the database. On 26 out, 00:20, José F. Romaniello <[email protected]> wrote: > Your manytoone looks wrong.. class=“CustomerS“, your class name is > customer (singular) > > 2010/10/25, Max André Bündchen <[email protected]>: > > > > > > > > > > > I'm starting with NHibernate 3.0 Beta 1 (downloaded form SourceForge). > > This samples is running in VS 2010. > > > One simple example doesn't work and I don't found the why. > > > The statment: > > > var customers = (from c in session.QueryOver<Customers> where > > c.CustomerID == 1 select c).List(); > > Assert.AreEqual(2,customers.Contacts.Count); > > > The result for that example should be 2 but is 0. > > > Classes: > > > public class Customers > > { > > public virtual Int32 CustomerID { get; set; } // Map for column > > CustomerID. > > ... > > public virtual IList<Contacts> Contacts { get; set; } > > ... > > public Customers() > > { > > Contacts = new List<Contacts>(); > > } > > } > > > public class Contacts > > { > > public virtual Int32 ContactID { get; set; } // Map for column > > ContactID. > > ... > > public virtual Customers Customer { get; set; } > > } > > > Relevant mapping for table Customers: > > <bag name="Contatcs" cascade="all-delete-orphan" lazy="false"> > > <key column="CustomerID"/> > > <one-to-many class="Contacts"/> > > </bag> > > > Relevant mapping for table Contatcs: > > <many-to-one name="Customer" class="Customers" column="CustomerID" not- > > null="true"/> > > > -- > > 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. > > -- > Enviado desde mi dispositivo móvil -- 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.
