Fabio,

The inverse="true" doesn't did the trick (I had try it but not comment
here). However this works fine:

var contacts = (from c in session.QueryOver<Contacts> where
c.Customer.CustomerID == 1 select c).List();
Assert(2, contacts.Count);

On 25 out, 18:34, Fabio Maulo <[email protected]> wrote:
> inverse="true"
>
>
> > 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.

Reply via email to