Expand definition with GetManager.Find< >

Hi

Is there a way to expand a specific proxyList using GetManager.Find< > ?
Currently I'm using

TXDataOperationContext.Current.GetManager.ProxyListLoadDepth := 1; // or 2 or more
TXDataOperationContext.Current.GetManager.Find<TObject>(id_object)

But in this case it expands all sub objects by proxyList

  1. it can be heavy and long for not useful data
  2. it can expose data without control

Thanks for you help
Sylvain

You can use CreateAlias('MyAssociation', 'a', 'TFetchMode.Eager):

https://doc.tmssoftware.com/biz/aurelius/guide/queries.html#specifying-eager-fetching-for-associations-loaded-as-lazy-by-default

Thanks Wagner

Indeed, it seems to be the right way but unfortunately, I get difficulties to find the right syntax with FetchEager behind a Find<> with Id.

TXDataOperationContext.Current.GetManager.Find<TObject>(id_object).FetchEager('subobject'));

is wrong.
Same with CreateAlias.

What's the right syntax to use in this case?

Thanks

I found a working syntax but not sure it's the bes

TXDataOperationContext.Current.GetManager.Find<TObject>.CreateAlias('SubObjectList', 'sobj', TFetchMode.Eager).Where(Linq['id_object'] = id_object).UniqueResult);

That is correct.
Note that since you are loading a single object, you could just force the proxy load this way as well:

Object := TXDataOperationContext.Current.GetManager.Find<TObject>(id_object);
Object.SubObject;  //forces loading of SubObject

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.