inverse="true"
On Mon, Oct 25, 2010 at 3:04 PM, Max André Bündchen
<[email protected]>wrote:
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>
--
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.