views:

187

answers:

0

I am new to Nhibernate and fluent nHibernate so i'm sure I'm missing something obvious. My problem is I have a class with a IList<> that just won't load.

My class is Customer and it has a IList< CustomerImage>. My Customer class loads properly except for this list.

Mapping:

CustomerMap :ClassMap< Customer> {

Id(x => x.CustId).TheColumnNameIs("custid");

... normal mappings which work fine

HasMany< CustomerImage>(x => x.CustomerImageList).WithKeyColumn("custid").AsBag() ; //custid is foreign key in images table.

}

CustomerImageMap : ClassMap< CustomerImage>{

Id(x => x.PhotoId).TheColumnNameIs("photoid");

... just normal mappings here

}

I load the object using session.Get< Customer>(...) and Initialize() the object returned.

There are no errors thrown and i have run the generated sql which returns rows from the images tables. However my collection always has zero items. How can i troubleshoot this problem further?

related questions