Criterias/Filtering on Proxys before loading

Hi,

if i have a Object with an associated List like

type TPerson = class(TObject)
           FInvoices : Proxy<TList<TInvoices>>
         Constructor Create;
        end;

is it possible to use/create criterias or filters on/before loading the list or do i always get the complete List ?

Hi,

unfortunately that is not possible, only the full list. But you can of course just use a criteria to get the invoices filtered by any criteria you want.

if i declare a object like


 TCustomer = class(TObject)
   [transient]
   FInvoices : TList<TInvoices>;
 protected
    procedure loadInvoices;
 end;



and manage the loading of the list by my code - which is what you suggested -  is a query like the following still possible :


 perObjectManager.Find<TCustomer>
      .CreateAlias('Invoices',i)
         .Linq['invoiceDate']='01.01.2016';



to get customers by properties or features of the invoices they have or do i loose this option?

cu Hans-Joerg

You can do that but with a workaround. Declare two lists: one transient (that you manually load) and another "normal" one (mapped). But then declare this second list as a Proxy and never load such proxy. This way it won't affect anything, but you will be able to do the query you want (so Aurelius will know how to build that SQL).

Using two lists was my first thought also. Its not so elegant but it works.

If i copy n paste the complete code for proxy, and change the
implementation of proxy.load, using my "proxy2" instead of yours, could
this result in trouble?

As a suggesstion (not important), i see that proxy is declared as a simple record and the list itself will be delivered by "proxycontroller".

If it is possible to get access to the object wich implement the proxycontroller, these class could have some mechanism for a user genereted list, maybe an event or something else.

cu Hans Joerg


I guess copying and writing your own Proxy<> implementation won't work, unfortunately.