Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Load Style" methods to TMVCActiveRecord #675

Closed
danieleteti opened this issue Aug 8, 2023 · 0 comments
Closed

Add "Load Style" methods to TMVCActiveRecord #675

danieleteti opened this issue Aug 8, 2023 · 0 comments
Assignees
Milestone

Comments

@danieleteti
Copy link
Owner

Currently TMVCActiveRecord and its class helper, provide "Factory Style" methods.

With such kind of methods the result list is returned by the loader method (as shown in this piece of code from the TMVCActiveRecord show case sample).

  Log('>> RQL Query (2) - ' + cRQL2);
  lCustList := TMVCActiveRecord.SelectRQL<TCustomer>(cRQL2, 20);
  try
    Log(lCustList.Count.ToString + ' record/s found');
    for lCustomer in lCustList do
    begin
      Log(Format('%5s - %s (%s)', [lCustomer.Code.ValueOrDefault,
        lCustomer.CompanyName.ValueOrDefault, lCustomer.City]));
    end;
  finally
    lCustList.Free;
  end;

For some scenarios would be useful to have also "Load Style" methods where the list is filled by the loader method (not instantiated internally).

  Log('>> RQL Query (2) - ' + cRQL2);
  lCustList := TObjectList<TCustomer>.Create;
  try
    lRecCount := TMVCActiveRecord.SelectRQL<TCustomer>(cRQL2, 20, lCustList);
    Log(lRecCount.ToString + ' record/s found');
    for lCustomer in lCustList do
    begin
      Log(Format('%5s - %s (%s)', [lCustomer.Code.ValueOrDefault,
        lCustomer.CompanyName.ValueOrDefault, lCustomer.City]));
    end;
  finally
    lCustList.Free;
  end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant