Load multiple collections with least queries

15 views
Skip to first unread message

simon.m.fox

unread,
Feb 29, 2012, 4:05:23 PM2/29/12
to nhu...@googlegroups.com
Hi

I have the following model structure

Contract -> IEnumerable<ContractInputSpotLine>
ContractInputSpotLine -> IEnumerable<ContractSpotLine>

I need to calculate a value for the contract which is based on values in the ContractSpotLine so need to load all ContractInputSpotLines with all related ContractSpotLines. Everything I try so far I seem to run in to cartesian product type issues. I am currently using Linq with Fetch, but wouldn't mind using the Criteria API either. Can anyone point me in the right direction to some decent documentation on this type of issue or provide some sample code to push me in the right direction. I've currently tried the following (which I found on stackoverflow)

Session.QueryOver<Contract>() 
   
.Fetch(c => c.ContractInputSpotLines)
    .Fetch(c => c.ContractInputSpotLines[0].ContractSpotLines)




Oskar Berggren

unread,
Mar 1, 2012, 2:44:11 PM3/1/12
to nhu...@googlegroups.com
2012/2/29 simon.m.fox <simon...@gmail.com>:

> Hi
>
> I have the following model structure
>
> Contract -> IEnumerable<ContractInputSpotLine>
> ContractInputSpotLine -> IEnumerable<ContractSpotLine>
>


Have you experimented with batch sizes on the class and collection mappings?

/Oskar

Reply all
Reply to author
Forward
0 new messages