The nearest solution I can see is to use the default_batch_fetch_size configuration setting <http://nhibernate.info/doc/nhibernate-reference/session-configuration.html#configuration-optional> and build different session factories according to the values you require, then use the appropriate session factory to get a session with the default batch-size your current task requires. That is a bit heavy weighted solution though. It also implies to have no explicit batch-size set in the mapping for entities and collections which would need to use the default one.
Le vendredi 30 juin 2017 10:45:59 UTC+2, Rainer H a écrit : > > Hi, > > I'm using NHibernate 4.0 with mapping by code. I know that I can set the > batch-size of bags/collection within the mapping-file > to avoid N+1 problem. *BUT *is it possible to set the batch-size of > defined bags/collections per session or even better per transaction? We have > many situation in which the batching would make our application slower as > not needed data is loaded. In other situations > it would speed things extremly up. > > *Fetch() is not an option in this special cases.* > > Thanks > > > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.
