Set TFetchMode.Eager(Master-Detail-Detail-Detail)

Hi,
   I need to Eager Load, a Master-Detail-Detail-Detail-Datail. The Many Value Associations are set by default to lazy load.
  I need something like:
    CreateAlias('WktWkPnList', 'aWktWkPnList', TFetchMode.Eager), //not work
  like i do in Associations.
    I don't want to change ManyValueAssociations to eager load in the Schema, since this is a particular case.
    Thanks


TFetchMode.Eager  in ManyValuedAssociation was not implemented because it doesn't improve performance, the lists are retrieved using a different select in either case. 

ok, seems right, but,...
for instance: Tinvoice and TInvoiceItems, with DataSnap rest service(ISAPI), some times all object (TInvoice+TinvoiceItems) is requeired, some times not. If lazy load by default(TInvoice+TinvoiceItems), and in particular case eager load is required, how to force load the the whole object?
  Perhaps "force " load Object with "for Items in ItemsList do", complicated when you have many ManyValueAssociations (Master-Detail-Detail-...), and if Configs.MaxEagerFetchDepth reached, increase Configs.MaxEagerFetchDepth(is this OK?) and then restore Configs.MaxEagerFetchDepth to deafult.
  Must be another way, :)
  Thanks, Wagner

You can just call Object.Items, that would be enough to load the items. MaxEagerFetchDepth has no effect on lazy-loaded associations. 

Hi,
  Sorry, sometthing like this?
  for i:= 0 to Result.Count-1 do
  begin
    for j := 0 to Result.Items.WktWStList.Count-1 do
    begin
       Result.Items.WktWStList.Items[j];
       ...
         ...
   With a "for" to every detail (Master-Detail-Detail-Detail-Datail)?
 
 
Another topic, its safe set MaxEagerFetchDepth := 5 and after call
"Manager.find" set to default again?   (Manager is created for each
server method call, in this case eager load is enabled.)

  Thanks, thanks, thanks

I don't know your exact object structure, but for detail-detail, yes, you have to interact with the details as well.

It would be safe to change MaxEagerFEtchDepth that way if you are not using thread. Since you say you are using DataSnap, it's not safe because such config is global and could affect other threads using other managers.

Ok,thanks