Skip to content

Add "Load Style" methods to TMVCActiveRecord #675

@danieleteti

Description

@danieleteti

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;

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions