c# - NHibernate Eager Load Collections with MultiQuery/MultiCriteria when starting point is a List<Entity> -


i have seen similar answers questions have single entity , want load of collections using multiple queries (instead of large set of joins):

nhibernate multiquery eager loading without joins

my question is, how do similar thing when starting point query list of entities.

details

types: containertype, collectiontype1, collectiontype2, collectiontype[3....10]

containertype {     list<collectiontype1> collection;     list<collectiontype2> collection2; }  collectiontype1 {     list<collectiontype1> childcollection;      list<collectiontype3> childcollection3;     ...     list<collectiontype10> childcollection10; } 

what want avoid

list<containertype> containers = new session.linq<containertype>()     .fetchmany(container => container.collection)     .thenfetchmany(collection => collection.childcollection)     .fetchmany(container => container.collection2)     .tolist(); 

is there way use multiquery/multicriteria set these joins assuming don't have single id can relate them to?

how got working desired

session.linq<containertype>     .fetchmany(container => container.collectiontype1s)     .tolist();  session.linq<collectiontype1>     .fetchmany(parent => parent.children)     .tolist();  session.linq<collectiontype1>     .fetchmany(alltype1s => alltype1s.collectiontype3)     .thenfetchmany(type3 => type3.collectiontype3_1) // etc.      // etc.     .tolist();  // etc.  list<containertype> containers = session.linq<containertype>()     .tolist(); 

it works single entity, since they'll in cache:

session.linq<containertype>()     .fetchmany(container => container.collection2)     .tofuture();  list<containertype> containers = session.linq<containertype>()     .fetchmany(container => container.collection)     .thenfetchmany(collection => collection.childcollection)     .tolist(); 

the problem fetch container twice, may slow if have lots of data or large text fields...


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -